summaryrefslogtreecommitdiff
path: root/user
diff options
context:
space:
mode:
Diffstat (limited to 'user')
-rw-r--r--user/clang/APKBUILD4
-rw-r--r--user/clang/secure-plt.patch70
-rw-r--r--user/cups-filters/APKBUILD2
-rw-r--r--user/llvm6/APKBUILD4
-rw-r--r--user/llvm6/secure-plt.patch208
-rw-r--r--user/perl-inline-c/APKBUILD35
-rw-r--r--user/perl-x11-xcb/APKBUILD11
-rw-r--r--user/valgrind/0001-Ensure-ELFv2-is-supported-on-PPC64.patch817
-rw-r--r--user/valgrind/APKBUILD10
-rw-r--r--user/valgrind/coregrind-elfv2.patch443
-rw-r--r--user/vlc/APKBUILD2
11 files changed, 1149 insertions, 457 deletions
diff --git a/user/clang/APKBUILD b/user/clang/APKBUILD
index 826ca3373..a95693351 100644
--- a/user/clang/APKBUILD
+++ b/user/clang/APKBUILD
@@ -19,6 +19,7 @@ source="https://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz
0001-Add-support-for-Ad-lie-Linux.patch
0008-Fix-ClangConfig-cmake-LLVM-path.patch
use-llvm-lit.patch
+ secure-plt.patch
"
builddir="$srcdir/cfe-$pkgver.src"
@@ -86,4 +87,5 @@ analyzer() {
sha512sums="f64ba9290059f6e36fee41c8f32bf483609d31c291fcd2f77d41fecfdf3c8233a5e23b93a1c73fed03683823bd6e72757ed993dd32527de3d5f2b7a64bb031b9 cfe-6.0.1.src.tar.xz
44aa152d50822a9e1a223b9e07e150ffa830c55deb4c4ca29e6218a0103eb263a00b41fd1ca84390e65fa08005901a0a0f88cf529bff8764220e99d06adef5fc 0001-Add-support-for-Ad-lie-Linux.patch
9485fe4fd6182df543735ed8f4ce618693d0faeafa86d3f9574a6c7abf50978e2d56e0a94be3ed94d515cc937c388d66ceff1bbc9bb120d371b6d3e95340da00 0008-Fix-ClangConfig-cmake-LLVM-path.patch
-8a596e7369b5791e7e9c3278320aa5bac30d91f27d9a0df335ea862c359623869353d12145c3b64730f721600522f3acc5abe706428091482e0209e4ff308175 use-llvm-lit.patch"
+8a596e7369b5791e7e9c3278320aa5bac30d91f27d9a0df335ea862c359623869353d12145c3b64730f721600522f3acc5abe706428091482e0209e4ff308175 use-llvm-lit.patch
+23c3de4f8cbfa115b337ee115b4f95eb1ce3b8c6451de590b0ecf196a4b3bc96ab1d88029edf7f0c51299dffb7b2a05cade9c64c72dba18d858686466bb82bad secure-plt.patch"
diff --git a/user/clang/secure-plt.patch b/user/clang/secure-plt.patch
new file mode 100644
index 000000000..c1b4cb1de
--- /dev/null
+++ b/user/clang/secure-plt.patch
@@ -0,0 +1,70 @@
+Index: cfe/include/clang/Driver/Options.td
+===================================================================
+--- cfe/include/clang/Driver/Options.td
++++ cfe/include/clang/Driver/Options.td
+@@ -1957,6 +1957,7 @@
+ def mno_altivec : Flag<["-"], "mno-altivec">, Group<m_ppc_Features_Group>;
+ def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
+ def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>;
++def msecure_plt : Flag<["-"], "msecure-plt">, Group<m_ppc_Features_Group>;
+ def mpower8_vector : Flag<["-"], "mpower8-vector">,
+ Group<m_ppc_Features_Group>;
+ def mno_power8_vector : Flag<["-"], "mno-power8-vector">,
+Index: cfe/lib/Driver/ToolChains/Arch/PPC.h
+===================================================================
+--- cfe/lib/Driver/ToolChains/Arch/PPC.h
++++ cfe/lib/Driver/ToolChains/Arch/PPC.h
+@@ -29,10 +29,17 @@
+ Hard,
+ };
+
++enum class ReadGOTPtrMode {
++ Bss,
++ SecurePlt,
++};
++
+ FloatABI getPPCFloatABI(const Driver &D, const llvm::opt::ArgList &Args);
+
+ std::string getPPCTargetCPU(const llvm::opt::ArgList &Args);
+ const char *getPPCAsmModeForCPU(StringRef Name);
++ReadGOTPtrMode getPPCReadGOTPtrMode(const Driver &D,
++ const llvm::opt::ArgList &Args);
+
+ void getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple,
+ const llvm::opt::ArgList &Args,
+Index: cfe/lib/Driver/ToolChains/Arch/PPC.cpp
+===================================================================
+--- cfe/lib/Driver/ToolChains/Arch/PPC.cpp
++++ cfe/lib/Driver/ToolChains/Arch/PPC.cpp
+@@ -106,6 +106,16 @@
+ ppc::FloatABI FloatABI = ppc::getPPCFloatABI(D, Args);
+ if (FloatABI == ppc::FloatABI::Soft)
+ Features.push_back("-hard-float");
++
++ ppc::ReadGOTPtrMode ReadGOT = ppc::getPPCReadGOTPtrMode(D, Args);
++ if (ReadGOT == ppc::ReadGOTPtrMode::SecurePlt)
++ Features.push_back("+secure-plt");
++}
++
++ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const ArgList &Args) {
++ if (Args.getLastArg(options::OPT_msecure_plt))
++ return ppc::ReadGOTPtrMode::SecurePlt;
++ return ppc::ReadGOTPtrMode::Bss;
+ }
+
+ ppc::FloatABI ppc::getPPCFloatABI(const Driver &D, const ArgList &Args) {
+Index: cfe/test/Driver/ppc-features.cpp
+===================================================================
+--- cfe/test/Driver/ppc-features.cpp
++++ cfe/test/Driver/ppc-features.cpp
+@@ -22,6 +22,10 @@
+ // RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -mhard-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTHARD %s
+ // CHECK-SOFTHARD-NOT: "-target-feature" "-hard-float"
+
++// check -msecure-plt option for ppc32
++// RUN: %clang -target powerpc-unknown-linux-gnu -msecure-plt %s -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SECUREPLT %s
++// CHECK-SECUREPLT: "-target-feature" "+secure-plt"
++
+ // check -mfloat-abi=x option
+ // RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=x -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ERRMSG %s
+ // CHECK-ERRMSG: error: invalid float ABI '-mfloat-abi=x'
diff --git a/user/cups-filters/APKBUILD b/user/cups-filters/APKBUILD
index 4a29feb9c..9e174a77c 100644
--- a/user/cups-filters/APKBUILD
+++ b/user/cups-filters/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Max Rees <maxcrees@me.com>
pkgname=cups-filters
pkgver=1.21.2
-pkgrel=0
+pkgrel=1
pkgdesc="OpenPrinting CUPS filters and backends"
url="https://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdf_as_standard_print_job_format"
arch="all"
diff --git a/user/llvm6/APKBUILD b/user/llvm6/APKBUILD
index d29026f24..f3bc9acc7 100644
--- a/user/llvm6/APKBUILD
+++ b/user/llvm6/APKBUILD
@@ -23,6 +23,7 @@ source="http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.xz
disable-FileSystemTest.CreateDir-perms-assert.patch
disable-dlclose-test.patch
musl-ppc64-elfv2.patch
+ secure-plt.patch
"
builddir="$srcdir/$_pkgname-$pkgver.src"
@@ -244,4 +245,5 @@ f84cd65d7042e89826ba6e8d48c4c302bf4980da369d7f19a55f217e51c00ca8ed178d453df3a3ce
6d1a716e5aa24e6b9a3acf4cc11e2504b1b01abf574074e9e5617b991de87d5e4e687eb18e85e73d5e632568afe2fc357771c4c96f9e136502071991496fb78c cmake-fix-libLLVM-name.patch
49c47f125014b60d0ea7870f981a2c1708ad705793f89287ed846ee881a837a4dc0170bf467e03f2ef56177473128945287749ac80dc2d13cfabcf8b929ba58a disable-FileSystemTest.CreateDir-perms-assert.patch
caeec8e4dbd92f5f74940780b69075f3879a267a8623822cbdc193fd14706eb089071e3a5a20d60cc2eca59e4c5b2a61d29827a2f3362ee7c5f74f11d9ace200 disable-dlclose-test.patch
-bde743960003a2a39868af9f665d86fadb0a7b1e7eb51c16ebbd74ce4c5220bbc400b1d5211c02fc2643863f49ee961e9a18dffa0eb813a0e1723613396512ab musl-ppc64-elfv2.patch"
+bde743960003a2a39868af9f665d86fadb0a7b1e7eb51c16ebbd74ce4c5220bbc400b1d5211c02fc2643863f49ee961e9a18dffa0eb813a0e1723613396512ab musl-ppc64-elfv2.patch
+35d289641fa4d200b5a3f62f1d51da600a734641356b0dc6c54a3080dd89aec3b031e36af8b53be49c35346c1cbcce00268de7ec9b4f552bfd7bf84d3504d1c4 secure-plt.patch"
diff --git a/user/llvm6/secure-plt.patch b/user/llvm6/secure-plt.patch
new file mode 100644
index 000000000..e8af33d87
--- /dev/null
+++ b/user/llvm6/secure-plt.patch
@@ -0,0 +1,208 @@
+Index: llvm/lib/Target/PowerPC/PPC.td
+===================================================================
+--- llvm/lib/Target/PowerPC/PPC.td
++++ llvm/lib/Target/PowerPC/PPC.td
+@@ -119,6 +119,8 @@
+ [FeatureBookE]>;
+ def FeatureE500 : SubtargetFeature<"e500", "IsE500", "true",
+ "Enable E500/E500mc instructions">;
++def FeatureSecurePlt : SubtargetFeature<"secure-plt","SecurePlt", "true",
++ "Enable secure plt mode">;
+ def FeaturePPC4xx : SubtargetFeature<"ppc4xx", "IsPPC4xx", "true",
+ "Enable PPC 4xx instructions">;
+ def FeaturePPC6xx : SubtargetFeature<"ppc6xx", "IsPPC6xx", "true",
+Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+===================================================================
+--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+@@ -563,33 +563,63 @@
+ // Transform %rd = UpdateGBR(%rt, %ri)
+ // Into: lwz %rt, .L0$poff - .L0$pb(%ri)
+ // add %rd, %rt, %ri
++ // or into (if secure plt mode is on):
++ // addis r30, r30, .LTOC - .L0$pb@ha
++ // addi r30, r30, .LTOC - .L0$pb@l
+ // Get the offset from the GOT Base Register to the GOT
+ LowerPPCMachineInstrToMCInst(MI, TmpInst, *this, isDarwin);
+- MCSymbol *PICOffset =
+- MF->getInfo<PPCFunctionInfo>()->getPICOffsetSymbol();
+- TmpInst.setOpcode(PPC::LWZ);
+- const MCExpr *Exp =
+- MCSymbolRefExpr::create(PICOffset, MCSymbolRefExpr::VK_None, OutContext);
+- const MCExpr *PB =
+- MCSymbolRefExpr::create(MF->getPICBaseSymbol(),
+- MCSymbolRefExpr::VK_None,
+- OutContext);
+- const MCOperand TR = TmpInst.getOperand(1);
+- const MCOperand PICR = TmpInst.getOperand(0);
++ if (Subtarget->isSecurePlt() && isPositionIndependent() ) {
++ unsigned PICR = TmpInst.getOperand(0).getReg();
++ MCSymbol *LTOCSymbol = OutContext.getOrCreateSymbol(StringRef(".LTOC"));
++ const MCExpr *PB =
++ MCSymbolRefExpr::create(MF->getPICBaseSymbol(),
++ OutContext);
+
+- // Step 1: lwz %rt, .L$poff - .L$pb(%ri)
+- TmpInst.getOperand(1) =
+- MCOperand::createExpr(MCBinaryExpr::createSub(Exp, PB, OutContext));
+- TmpInst.getOperand(0) = TR;
+- TmpInst.getOperand(2) = PICR;
+- EmitToStreamer(*OutStreamer, TmpInst);
++ const MCExpr *LTOCDeltaExpr =
++ MCBinaryExpr::createSub(MCSymbolRefExpr::create(LTOCSymbol, OutContext),
++ PB, OutContext);
+
+- TmpInst.setOpcode(PPC::ADD4);
+- TmpInst.getOperand(0) = PICR;
+- TmpInst.getOperand(1) = TR;
+- TmpInst.getOperand(2) = PICR;
+- EmitToStreamer(*OutStreamer, TmpInst);
+- return;
++ const MCExpr *LTOCDeltaHi =
++ PPCMCExpr::createHa(LTOCDeltaExpr, false, OutContext);
++ EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::ADDIS)
++ .addReg(PICR)
++ .addReg(PICR)
++ .addExpr(LTOCDeltaHi));
++
++ const MCExpr *LTOCDeltaLo =
++ PPCMCExpr::createLo(LTOCDeltaExpr, false, OutContext);
++ EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::ADDI)
++ .addReg(PICR)
++ .addReg(PICR)
++ .addExpr(LTOCDeltaLo));
++ return;
++ } else {
++ MCSymbol *PICOffset =
++ MF->getInfo<PPCFunctionInfo>()->getPICOffsetSymbol();
++ TmpInst.setOpcode(PPC::LWZ);
++ const MCExpr *Exp =
++ MCSymbolRefExpr::create(PICOffset, MCSymbolRefExpr::VK_None, OutContext);
++ const MCExpr *PB =
++ MCSymbolRefExpr::create(MF->getPICBaseSymbol(),
++ MCSymbolRefExpr::VK_None,
++ OutContext);
++ const MCOperand TR = TmpInst.getOperand(1);
++ const MCOperand PICR = TmpInst.getOperand(0);
++
++ // Step 1: lwz %rt, .L$poff - .L$pb(%ri)
++ TmpInst.getOperand(1) =
++ MCOperand::createExpr(MCBinaryExpr::createSub(Exp, PB, OutContext));
++ TmpInst.getOperand(0) = TR;
++ TmpInst.getOperand(2) = PICR;
++ EmitToStreamer(*OutStreamer, TmpInst);
++
++ TmpInst.setOpcode(PPC::ADD4);
++ TmpInst.getOperand(0) = PICR;
++ TmpInst.getOperand(1) = TR;
++ TmpInst.getOperand(2) = PICR;
++ EmitToStreamer(*OutStreamer, TmpInst);
++ return;
++ }
+ }
+ case PPC::LWZtoc: {
+ // Transform %r3 = LWZtoc @min1, %r2
+@@ -1233,7 +1263,7 @@
+
+ if (!Subtarget->isPPC64()) {
+ const PPCFunctionInfo *PPCFI = MF->getInfo<PPCFunctionInfo>();
+- if (PPCFI->usesPICBase()) {
++ if (PPCFI->usesPICBase() && !Subtarget->isSecurePlt()) {
+ MCSymbol *RelocSymbol = PPCFI->getPICOffsetSymbol();
+ MCSymbol *PICBase = MF->getPICBaseSymbol();
+ OutStreamer->EmitLabel(RelocSymbol);
+Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+===================================================================
+--- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
++++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
+@@ -4001,6 +4001,27 @@
+ return;
+ break;
+
++ case PPCISD::CALL: {
++ const Module *M = MF->getFunction().getParent();
++
++ if (PPCLowering->getPointerTy(CurDAG->getDataLayout()) != MVT::i32 ||
++ !PPCSubTarget->isSecurePlt() || !PPCSubTarget->isTargetELF() ||
++ M->getPICLevel() == PICLevel::SmallPIC)
++ break;
++
++ SDValue Op = N->getOperand(1);
++
++ if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(Op)) {
++ if (GA->getTargetFlags() == PPCII::MO_PLT)
++ getGlobalBaseReg();
++ }
++ else if (ExternalSymbolSDNode *ES = dyn_cast<ExternalSymbolSDNode>(Op)) {
++ if (ES->getTargetFlags() == PPCII::MO_PLT)
++ getGlobalBaseReg();
++ }
++ }
++ break;
++
+ case PPCISD::GlobalBaseReg:
+ ReplaceNode(N, getGlobalBaseReg());
+ return;
+Index: llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+===================================================================
+--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+@@ -107,10 +107,20 @@
+ break;
+ }
+
+- if (MO.getTargetFlags() == PPCII::MO_PLT)
++ if (MO.getTargetFlags() == PPCII::MO_PLT)
+ RefKind = MCSymbolRefExpr::VK_PLT;
+
++ const MachineFunction *MF = MO.getParent()->getParent()->getParent();
++ const PPCSubtarget *Subtarget = &(MF->getSubtarget<PPCSubtarget>());
++ const TargetMachine &TM = Printer.TM;
+ const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx);
++ // -msecure-plt option works only in PIC mode. If secure plt mode
++ // is on add 32768 to symbol.
++ if (Subtarget->isSecurePlt() && TM.isPositionIndependent() &&
++ MO.getTargetFlags() == PPCII::MO_PLT)
++ Expr = MCBinaryExpr::createAdd(Expr,
++ MCConstantExpr::create(32768, Ctx),
++ Ctx);
+
+ if (!MO.isJTI() && MO.getOffset())
+ Expr = MCBinaryExpr::createAdd(Expr,
+Index: llvm/lib/Target/PowerPC/PPCSubtarget.h
+===================================================================
+--- llvm/lib/Target/PowerPC/PPCSubtarget.h
++++ llvm/lib/Target/PowerPC/PPCSubtarget.h
+@@ -133,6 +133,7 @@
+ bool HasFloat128;
+ bool IsISA3_0;
+ bool UseLongCalls;
++ bool SecurePlt;
+
+ POPCNTDKind HasPOPCNTD;
+
+@@ -255,6 +256,7 @@
+ bool hasOnlyMSYNC() const { return HasOnlyMSYNC; }
+ bool isPPC4xx() const { return IsPPC4xx; }
+ bool isPPC6xx() const { return IsPPC6xx; }
++ bool isSecurePlt() const {return SecurePlt; }
+ bool isE500() const { return IsE500; }
+ bool isFeatureMFTB() const { return FeatureMFTB; }
+ bool isDeprecatedDST() const { return DeprecatedDST; }
+Index: llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll
+===================================================================
+--- llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll
++++ llvm/test/CodeGen/PowerPC/ppc32-pic-large.ll
+@@ -1,4 +1,5 @@
+ ; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic | FileCheck -check-prefix=LARGE-BSS %s
++; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -mattr=+secure-plt -relocation-model=pic | FileCheck -check-prefix=LARGE-SECUREPLT %s
+ @bar = common global i32 0, align 4
+
+ declare i32 @call_foo(i32, ...)
+@@ -29,3 +30,6 @@
+ ; LARGE-BSS: [[VREF]]:
+ ; LARGE-BSS-NEXT: .p2align 2
+ ; LARGE-BSS-NEXT: .long bar
++; LARGE-SECUREPLT: addis 30, 30, .LTOC-.L0$pb@ha
++; LARGE-SECUREPLT: addi 30, 30, .LTOC-.L0$pb@l
++; LARGE-SECUREPLT: bl call_foo@PLT+32768
diff --git a/user/perl-inline-c/APKBUILD b/user/perl-inline-c/APKBUILD
new file mode 100644
index 000000000..50d298bb0
--- /dev/null
+++ b/user/perl-inline-c/APKBUILD
@@ -0,0 +1,35 @@
+# Contributor: Dan Theisen <djt@hxx.in>
+# Maintainer: Adélie Perl Team <adelie-perl@lists.adelielinux.org>
+pkgname=perl-inline-c
+pkgver=0.78
+pkgrel=0
+pkgdesc="C Language Support for Inline"
+url="https://metacpan.org/pod/Inline::C"
+arch="noarch"
+license="GPL-1.0+ OR Artistic-1.0-Perl"
+depends="perl perl-inline perl-pegex perl-parse-recdescent"
+makedepends="perl-dev perl-file-sharedir-install"
+checkdepends="perl-test-warn perl-yaml-libyaml perl-file-copy-recursive"
+install=""
+subpackages="$pkgname-doc"
+source="https://cpan.metacpan.org/authors/id/T/TI/TINITA/Inline-C-$pkgver.tar.gz"
+builddir="$srcdir/Inline-C-$pkgver"
+
+build() {
+ cd "$builddir"
+ PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
+ make
+}
+
+check() {
+ cd "$builddir"
+ make test
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+ find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
+}
+
+sha512sums="368e68dfb9f1700534d9b391090e340172e3adde5fe15576f883e9341047fec35cea8660751883b27e128ad91dda363d513547368097a989457d669bbbdc8ce4 Inline-C-0.78.tar.gz"
diff --git a/user/perl-x11-xcb/APKBUILD b/user/perl-x11-xcb/APKBUILD
index b28a86211..070b97db9 100644
--- a/user/perl-x11-xcb/APKBUILD
+++ b/user/perl-x11-xcb/APKBUILD
@@ -7,12 +7,13 @@ pkgdesc="Perl bindings for libxcb"
url="https://metacpan.org/pod/X11::XCB"
arch="all"
license="Artistic-1.0-Perl AND GPL-2.0"
-depends="perl perl-extutils-pkgconfig perl-extutils-depends perl-xs-object-magic
- perl-xs-object-magic-dev perl-data-dump perl-xml-simple perl-xml-descent
- perl-mouse perl-mousex-nativetraits"
-makedepends="perl-dev"
+depends="perl perl-extutils-pkgconfig perl-extutils-depends
+ perl-xs-object-magic perl-data-dump perl-xml-simple
+ perl-xml-descent perl-mouse perl-mousex-nativetraits"
+makedepends="perl-dev perl-xs-object-magic-dev libxcb-dev
+ xcb-util-dev xcb-util-wm-dev"
checkdepends="perl-test-deep perl-test-exception"
-install=""
+options="!check" # Tests require a running X server
subpackages="$pkgname-doc"
source="https://cpan.metacpan.org/authors/id/M/MS/MSTPLBG/X11-XCB-$pkgver.tar.gz"
builddir="$srcdir/X11-XCB-$pkgver"
diff --git a/user/valgrind/0001-Ensure-ELFv2-is-supported-on-PPC64.patch b/user/valgrind/0001-Ensure-ELFv2-is-supported-on-PPC64.patch
new file mode 100644
index 000000000..5272406ec
--- /dev/null
+++ b/user/valgrind/0001-Ensure-ELFv2-is-supported-on-PPC64.patch
@@ -0,0 +1,817 @@
+From a5224eb31a4c8a680587e74cc402e5ed92ead216 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Thu, 27 Sep 2018 15:42:40 -0500
+Subject: [PATCH] Ensure ELFv2 is supported on PPC64
+
+---
+ coregrind/m_dispatch/dispatch-ppc64be-linux.S | 107 ++++++++++++++++--
+ coregrind/m_initimg/initimg-linux.c | 5 +-
+ coregrind/m_libcsetjmp.c | 7 +-
+ coregrind/m_machine.c | 3 +-
+ coregrind/m_main.c | 19 ++--
+ coregrind/m_sigframe/sigframe-ppc64-linux.c | 3 +-
+ coregrind/m_signals.c | 11 +-
+ coregrind/m_stacktrace.c | 12 +-
+ coregrind/m_syscall.c | 9 +-
+ coregrind/m_syswrap/syscall-ppc64be-linux.S | 19 +++-
+ coregrind/m_syswrap/syswrap-ppc64-linux.c | 9 +-
+ coregrind/m_trampoline.S | 4 +-
+ coregrind/m_translate.c | 23 ++--
+ coregrind/m_ume/elf.c | 8 +-
+ coregrind/pub_core_machine.h | 12 +-
+ coregrind/vg_preloaded.c | 3 +-
+ include/valgrind.h | 16 ++-
+ memcheck/mc_leakcheck.c | 2 +-
+ memcheck/mc_machine.c | 3 +-
+ 19 files changed, 206 insertions(+), 69 deletions(-)
+
+diff --git a/coregrind/m_dispatch/dispatch-ppc64be-linux.S b/coregrind/m_dispatch/dispatch-ppc64be-linux.S
+index 91bd3b236..eb8026c7c 100644
+--- a/coregrind/m_dispatch/dispatch-ppc64be-linux.S
++++ b/coregrind/m_dispatch/dispatch-ppc64be-linux.S
+@@ -75,14 +75,26 @@ void VG_(disp_run_translations)( UWord* two_words,
+ .section ".text"
+ .align 2
+ .globl VG_(disp_run_translations)
++#if _CALL_ELF == 2
++.type VG_(disp_run_translations),@function
++VG_(disp_run_translations):
++.type .VG_(disp_run_translations),@function
++#else
+ .section ".opd","aw"
+ .align 3
+ VG_(disp_run_translations):
+ .quad .VG_(disp_run_translations),.TOC.@tocbase,0
+ .previous
+ .type .VG_(disp_run_translations),@function
++#endif
+ .globl .VG_(disp_run_translations)
+ .VG_(disp_run_translations):
++#if _CALL_ELF == 2
++0: addis 2, 12,.TOC.-0b@ha
++ addi 2,2,.TOC.-0b@l
++ .localentry VG_(disp_run_translations), .-VG_(disp_run_translations)
++#endif
++
+ /* r3 holds two_words */
+ /* r4 holds guest_state */
+ /* r5 holds host_addr */
+@@ -231,6 +243,11 @@ VG_(disp_run_translations):
+
+ /* Set up the guest state ptr */
+ mr 31,4 /* r31 (generated code gsp) = r4 */
++#if _CALL_ELF == 2
++/* for the LE ABI need to setup r2 and r12 */
++0: addis 2, 12,.TOC.-0b@ha
++ addi 2,2,.TOC.-0b@l
++#endif
+
+ /* and jump into the code cache. Chained translations in
+ the code cache run, until for whatever reason, they can't
+@@ -385,7 +402,9 @@ VG_(disp_run_translations):
+ mtlr 0
+ addi 1,1,624 /* stack_size */
+ blr
+-
++#if _CALL_ELF == 2
++ .size VG_(disp_run_translations),.-VG_(disp_run_translations)
++#endif
+
+ /*----------------------------------------------------*/
+ /*--- Continuation points ---*/
+@@ -395,15 +414,25 @@ VG_(disp_run_translations):
+ .section ".text"
+ .align 2
+ .globl VG_(disp_cp_chain_me_to_slowEP)
+- .section ".opd","aw"
++#if _CALL_ELF == 2
++ .type VG_(disp_cp_chain_me_to_slowEP),@function
++ VG_(disp_cp_chain_me_to_slowEP):
++#else
++ .section ".opd","aw"
+ .align 3
+ VG_(disp_cp_chain_me_to_slowEP):
+ .quad .VG_(disp_cp_chain_me_to_slowEP),.TOC.@tocbase,0
+ .previous
++#endif
+ .type .VG_(disp_cp_chain_me_to_slowEP),@function
+ .globl .VG_(disp_cp_chain_me_to_slowEP)
+ .VG_(disp_cp_chain_me_to_slowEP):
+- /* We got called. The return address indicates
++#if _CALL_ELF == 2
++0: addis 2, 12,.TOC.-0b@ha
++ addi 2,2,.TOC.-0b@l
++ .localentry VG_(disp_cp_chain_me_to_slowEP), .-VG_(disp_cp_chain_me_to_slowEP)
++#endif
++ /* We got called. The return address indicates
+ where the patching needs to happen. Collect
+ the return address and, exit back to C land,
+ handing the caller the pair (Chain_me_S, RA) */
+@@ -415,20 +444,33 @@ VG_(disp_cp_chain_me_to_slowEP):
+ */
+ subi 7,7,20+4+4
+ b .postamble
++#if _CALL_ELF == 2
++ .size VG_(disp_cp_chain_me_to_slowEP),.-VG_(disp_cp_chain_me_to_slowEP)
++#endif
+
+ /* ------ Chain me to fast entry point ------ */
+ .section ".text"
+ .align 2
+ .globl VG_(disp_cp_chain_me_to_fastEP)
+- .section ".opd","aw"
++#if _CALL_ELF == 2
++ .type VG_(disp_cp_chain_me_to_fastEP),@function
++VG_(disp_cp_chain_me_to_fastEP):
++#else
++ .section ".opd","aw"
+ .align 3
+ VG_(disp_cp_chain_me_to_fastEP):
+ .quad .VG_(disp_cp_chain_me_to_fastEP),.TOC.@tocbase,0
+ .previous
++#endif
+ .type .VG_(disp_cp_chain_me_to_fastEP),@function
+ .globl .VG_(disp_cp_chain_me_to_fastEP)
+ .VG_(disp_cp_chain_me_to_fastEP):
+- /* We got called. The return address indicates
++#if _CALL_ELF == 2
++0: addis 2, 12,.TOC.-0b@ha
++ addi 2,2,.TOC.-0b@l
++ .localentry VG_(disp_cp_chain_me_to_fastEP), .-VG_(disp_cp_chain_me_to_fastEP)
++#endif
++ /* We got called. The return address indicates
+ where the patching needs to happen. Collect
+ the return address and, exit back to C land,
+ handing the caller the pair (Chain_me_S, RA) */
+@@ -440,20 +482,33 @@ VG_(disp_cp_chain_me_to_fastEP):
+ */
+ subi 7,7,20+4+4
+ b .postamble
++#if _CALL_ELF == 2
++ .size VG_(disp_cp_chain_me_to_fastEP),.-VG_(disp_cp_chain_me_to_fastEP)
++#endif
+
+ /* ------ Indirect but boring jump ------ */
+ .section ".text"
+ .align 2
+ .globl VG_(disp_cp_xindir)
+- .section ".opd","aw"
++#if _CALL_ELF == 2
++ .type VG_(disp_cp_xindir),@function
++VG_(disp_cp_xindir):
++#else
++ .section ".opd","aw"
+ .align 3
+ VG_(disp_cp_xindir):
+ .quad .VG_(disp_cp_xindir),.TOC.@tocbase,0
+ .previous
++#endif
+ .type .VG_(disp_cp_xindir),@function
+ .globl .VG_(disp_cp_xindir)
+ .VG_(disp_cp_xindir):
+- /* Where are we going? */
++#if _CALL_ELF == 2
++0: addis 2, 12,.TOC.-0b@ha
++ addi 2,2,.TOC.-0b@l
++ .localentry VG_(disp_cp_xindir), .-VG_(disp_cp_xindir)
++#endif
++ /* Where are we going? */
+ ld 3,OFFSET_ppc64_CIA(31)
+
+ /* stats only */
+@@ -479,6 +534,9 @@ VG_(disp_cp_xindir):
+ /* Found a match. Jump to .host. */
+ mtctr 7
+ bctr
++#if _CALL_ELF == 2
++ .size VG_(disp_cp_xindir),.-VG_(disp_cp_xindir)
++#endif
+
+ .fast_lookup_failed:
+ /* stats only */
+@@ -496,39 +554,64 @@ VG_(disp_cp_xindir):
+ .section ".text"
+ .align 2
+ .globl VG_(disp_cp_xassisted)
+- .section ".opd","aw"
++#if _CALL_ELF == 2
++ .type VG_(disp_cp_xassisted),@function
++VG_(disp_cp_xassisted):
++#else
++ .section ".opd","aw"
+ .align 3
+ VG_(disp_cp_xassisted):
+ .quad .VG_(disp_cp_xassisted),.TOC.@tocbase,0
+ .previous
+- .type .VG_(disp_cp_xassisted),@function
++#endif
++#if _CALL_ELF == 2
++0: addis 2, 12,.TOC.-0b@ha
++ addi 2,2,.TOC.-0b@l
++ .localentry VG_(disp_cp_xassisted), .-VG_(disp_cp_xassisted)
++#endif
++ .type .VG_(disp_cp_xassisted),@function
+ .globl .VG_(disp_cp_xassisted)
+ .VG_(disp_cp_xassisted):
+ /* r31 contains the TRC */
+ mr 6,31
+ li 7,0
+ b .postamble
++#if _CALL_ELF == 2
++ .size VG_(disp_cp_xassisted),.-VG_(disp_cp_xassisted)
++#endif
+
+ /* ------ Event check failed ------ */
+ .section ".text"
+ .align 2
+ .globl VG_(disp_cp_evcheck_fail)
+- .section ".opd","aw"
++#if _CALL_ELF == 2
++ .type VG_(disp_cp_evcheck_fail),@function
++VG_(disp_cp_evcheck_fail):
++#else
++ .section ".opd","aw"
+ .align 3
+ VG_(disp_cp_evcheck_fail):
+ .quad .VG_(disp_cp_evcheck_fail),.TOC.@tocbase,0
+ .previous
++#endif
++#if _CALL_ELF == 2
++0: addis 2, 12,.TOC.-0b@ha
++ addi 2,2,.TOC.-0b@l
++ .localentry VG_(disp_cp_evcheck_fail), .-VG_(disp_cp_evcheck_fail)
++#endif
+ .type .VG_(disp_cp_evcheck_fail),@function
+ .globl .VG_(disp_cp_evcheck_fail)
+ .VG_(disp_cp_evcheck_fail):
+ li 6,VG_TRC_INNER_COUNTERZERO
+ li 7,0
+ b .postamble
++#if _CALL_ELF == 2
++ .size VG_(disp_cp_evcheck_fail),.-VG_(disp_cp_evcheck_fail)
++#endif
+
+-
+ .size .VG_(disp_run_translations), .-.VG_(disp_run_translations)
+
+-#endif // defined(VGP_ppc64be_linux)
++#endif // defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
+
+ /* Let the linker know we don't need an executable stack */
+ MARK_STACK_NO_EXEC
+diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c
+index 61cc458bc..19df79705 100644
+--- a/coregrind/m_initimg/initimg-linux.c
++++ b/coregrind/m_initimg/initimg-linux.c
+@@ -1117,7 +1117,8 @@ void VG_(ii_finalise_image)( IIFinaliseImageInfo iifii )
+ arch->vex.guest_GPR1 = iifii.initial_client_SP;
+ arch->vex.guest_GPR2 = iifii.initial_client_TOC;
+ arch->vex.guest_CIA = iifii.initial_client_IP;
+-#if defined(VGP_ppc64le_linux)
++#if (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && !defined(VG_PLAT_USES_PPCTOC)
+ arch->vex.guest_GPR12 = iifii.initial_client_IP;
+ #endif
+
+diff --git a/coregrind/m_libcsetjmp.c b/coregrind/m_libcsetjmp.c
+index c73180640..ed96f4739 100644
+--- a/coregrind/m_libcsetjmp.c
++++ b/coregrind/m_libcsetjmp.c
+@@ -35,6 +35,7 @@
+
+ #include "pub_core_basics.h"
+ #include "pub_core_libcsetjmp.h" /* self */
++#include "pub_core_machine.h" /* VG_PLAT_USES_PPCTOC */
+
+ /* See include/pub_tool_libcsetjmp.h for background and rationale. */
+
+@@ -151,7 +152,8 @@ __asm__(
+
+ /* ------------ ppc64-linux ------------ */
+
+-#if defined(VGP_ppc64be_linux)
++#if (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && defined(VG_PLAT_USES_PPCTOC)
+
+ __asm__(
+ ".section \".toc\",\"aw\"" "\n"
+@@ -270,7 +272,8 @@ __asm__(
+ ".previous" "\n"
+ );
+
+-#elif defined(VGP_ppc64le_linux)
++#elif (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && !defined(VG_PLAT_USES_PPCTOC)
+ __asm__(
+ ".section \".toc\",\"aw\"" "\n"
+
+diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c
+index 31b0e1b6b..eb3e6a4e1 100644
+--- a/coregrind/m_machine.c
++++ b/coregrind/m_machine.c
+@@ -2035,7 +2035,8 @@ void* VG_(fnptr_to_fnentry)( void* f )
+ || defined(VGP_ppc32_linux) || defined(VGP_ppc64le_linux) \
+ || defined(VGP_s390x_linux) || defined(VGP_mips32_linux) \
+ || defined(VGP_mips64_linux) || defined(VGP_arm64_linux) \
+- || defined(VGP_x86_solaris) || defined(VGP_amd64_solaris)
++ || defined(VGP_x86_solaris) || defined(VGP_amd64_solaris) \
++ || (defined(VGP_ppc64be_linux) && !defined(VG_PLAT_USES_PPCTOC))
+ return f;
+ # elif defined(VGP_ppc64be_linux)
+ /* ppc64-linux uses the AIX scheme, in which f is a pointer to a
+diff --git a/coregrind/m_main.c b/coregrind/m_main.c
+index bf4a71284..102235dca 100644
+--- a/coregrind/m_main.c
++++ b/coregrind/m_main.c
+@@ -2274,7 +2274,7 @@ static void final_tidyup(ThreadId tid)
+ return; /* won't do it */
+ }
+
+-# if defined(VGP_ppc64be_linux)
++# if defined(VGP_ppc64be_linux) && defined(VG_PLAT_USES_PPCTOC)
+ Addr r2 = VG_(get_tocptr)(freeres_wrapper);
+ if (r2 == 0) {
+ VG_(message)(Vg_UserMsg,
+@@ -2306,9 +2306,11 @@ static void final_tidyup(ThreadId tid)
+ directly. However, we need to set R2 (the toc pointer)
+ appropriately. */
+ VG_(set_IP)(tid, freeres_wrapper);
+-# if defined(VGP_ppc64be_linux)
++# if (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && defined(VG_PLAT_USES_PPCTOC)
+ VG_(threads)[tid].arch.vex.guest_GPR2 = r2;
+-# elif defined(VGP_ppc64le_linux)
++# elif (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && !defined(VG_PLAT_USES_PPCTOC)
+ /* setting GPR2 but not really needed, GPR12 is needed */
+ VG_(threads)[tid].arch.vex.guest_GPR2 = freeres_wrapper;
+ VG_(threads)[tid].arch.vex.guest_GPR12 = freeres_wrapper;
+@@ -2610,9 +2612,10 @@ asm("\n"
+ "\ttrap\n"
+ ".previous\n"
+ );
+-#elif defined(VGP_ppc64be_linux)
++#elif (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && defined(VG_PLAT_USES_PPCTOC)
+ asm("\n"
+- /* PPC64 ELF ABI says '_start' points to a function descriptor.
++ /* PPC64 ELFv1 ABI says '_start' points to a function descriptor.
+ So we must have one, and that is what goes into the .opd section. */
+ "\t.align 2\n"
+ "\t.global _start\n"
+@@ -2656,9 +2659,9 @@ asm("\n"
+ "\tnop\n"
+ "\ttrap\n"
+ );
+-#elif defined(VGP_ppc64le_linux)
+-/* Little Endian uses ELF version 2 but in the future may also
+- * support other ELF versions.
++#elif (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && !defined(VG_PLAT_USES_PPCTOC)
++/* ELF version 2 does not use function descriptors.
+ */
+ asm("\n"
+ "\t.align 2\n"
+diff --git a/coregrind/m_sigframe/sigframe-ppc64-linux.c b/coregrind/m_sigframe/sigframe-ppc64-linux.c
+index b16606c22..cc657838f 100644
+--- a/coregrind/m_sigframe/sigframe-ppc64-linux.c
++++ b/coregrind/m_sigframe/sigframe-ppc64-linux.c
+@@ -263,7 +263,8 @@ void VG_(sigframe_create)( ThreadId tid,
+
+ /* Handler is in fact a standard ppc64-linux function descriptor,
+ so extract the function entry point and also the toc ptr to use. */
+-#if defined(VGP_ppc64be_linux)
++#if (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && defined(VG_PLAT_USES_PPCTOC)
+ SET_SIGNAL_GPR(tid, 2, (Addr) ((ULong*)handler)[1]);
+ tst->arch.vex.guest_CIA = (Addr) ((ULong*)handler)[0];
+ #else
+diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c
+index e572f17cc..52d939057 100644
+--- a/coregrind/m_signals.c
++++ b/coregrind/m_signals.c
+@@ -889,7 +889,9 @@ extern void my_sigreturn(void);
+ " sc\n" \
+ ".previous\n"
+
+-#elif defined(VGP_ppc64be_linux)
++#elif (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && defined(VG_PLAT_USES_PPCTOC)
++/* ELF version 1. Used in some legacy environments on LE, and most BE. */
+ # define _MY_SIGRETURN(name) \
+ ".align 2\n" \
+ ".globl my_sigreturn\n" \
+@@ -904,9 +906,10 @@ extern void my_sigreturn(void);
+ " li 0, " #name "\n" \
+ " sc\n"
+
+-#elif defined(VGP_ppc64le_linux)
+-/* Little Endian supports ELF version 2. In the future, it may
+- * support other versions.
++#elif (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && !defined(VG_PLAT_USES_PPCTOC)
++/* ELF version 2. In the future, PPC64 may support other versions. Used by
++ * most LE environments and any BE environment running musl libc.
+ */
+ # define _MY_SIGRETURN(name) \
+ ".align 2\n" \
+diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c
+index 24f1409dd..9be4c6da9 100644
+--- a/coregrind/m_stacktrace.c
++++ b/coregrind/m_stacktrace.c
+@@ -726,7 +726,8 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
+ Addr fp_max_orig )
+ {
+ Bool lr_is_first_RA = False;
+-# if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64le_linux)
++# if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64be_linux) \
++ || defined(VGP_ppc64le_linux)
+ Word redir_stack_size = 0;
+ Word redirs_used = 0;
+ # endif
+@@ -787,7 +788,8 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
+ redirs_used = 0;
+ # endif
+
+-# if defined(VG_PLAT_USES_PPCTOC) || defined (VGP_ppc64le_linux)
++# if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64be_linux) \
++ || defined(VGP_ppc64le_linux)
+ /* Deal with bogus LR values caused by function
+ interception/wrapping on ppc-TOC platforms; see comment on
+ similar code a few lines further down. */
+@@ -839,7 +841,8 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
+ /* On ppc64-linux (ppc64-elf, really), the lr save
+ slot is 2 words back from sp, whereas on ppc32-elf(?) it's
+ only one word back. */
+-# if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64le_linux)
++# if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64be_linux) \
++ || defined(VGP_ppc64le_linux)
+ const Int lr_offset = 2;
+ # else
+ const Int lr_offset = 1;
+@@ -858,7 +861,8 @@ UInt VG_(get_StackTrace_wrk) ( ThreadId tid_if_known,
+ else
+ ip = (((UWord*)fp)[lr_offset]);
+
+-# if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64le_linux)
++# if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64be_linux) \
++ || defined(VGP_ppc64le_linux)
+ /* Nasty hack to do with function replacement/wrapping on
+ ppc64-linux. If LR points to our magic return stub,
+ then we are in a wrapped or intercepted function, in
+diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c
+index 5948cecf5..c1cdfab27 100644
+--- a/coregrind/m_syscall.c
++++ b/coregrind/m_syscall.c
+@@ -470,7 +470,8 @@ asm(
+ ".previous\n"
+ );
+
+-#elif defined(VGP_ppc64be_linux)
++#elif (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && defined(VG_PLAT_USES_PPCTOC)
+ /* Due to the need to return 65 bits of result, this is completely
+ different from the ppc32 case. The single arg register points to a
+ 7-word block containing the syscall # and the 6 args. The syscall
+@@ -506,15 +507,15 @@ asm(
+ " blr\n"
+ );
+
+-#elif defined(VGP_ppc64le_linux)
++#elif (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && !defined(VG_PLAT_USES_PPCTOC)
+ /* Due to the need to return 65 bits of result, this is completely
+ different from the ppc32 case. The single arg register points to a
+ 7-word block containing the syscall # and the 6 args. The syscall
+ result proper is put in [0] of the block, and %cr0.so is in the
+ bottom bit of [1]. */
+ extern void do_syscall_WRK ( ULong* argblock );
+-/* Little Endian supports ELF version 2. In the future, it may support
+- * other versions as well.
++/* ELF version 2. In the future, PPC64 may support other versions as well.
+ */
+ asm(
+ ".align 2\n"
+diff --git a/coregrind/m_syswrap/syscall-ppc64be-linux.S b/coregrind/m_syswrap/syscall-ppc64be-linux.S
+index 16e9cedc0..db0d8b4aa 100644
+--- a/coregrind/m_syswrap/syscall-ppc64be-linux.S
++++ b/coregrind/m_syswrap/syscall-ppc64be-linux.S
+@@ -76,11 +76,24 @@
+
+ .align 2
+ .globl ML_(do_syscall_for_client_WRK)
++#if _CALL_ELF == 2
++.type .ML_(do_syscall_for_client_WRK),@function
++ML_(do_syscall_for_client_WRK):
++0: addis 2,12,.TOC.-0b@ha
++ addi 2,2,.TOC.-0b@l
++ .localentry ML_(do_syscall_for_client_WRK), .-ML_(do_syscall_for_client_WRK)
++#else
+ .section ".opd","aw"
+ .align 3
+-ML_(do_syscall_for_client_WRK):
++ML_(do_syscall_for_client_WRK):
+ .quad .ML_(do_syscall_for_client_WRK),.TOC.@tocbase,0
+ .previous
++#endif
++#if _CALL_ELF == 2
++0: addis 2,12,.TOC.-0b@ha
++ addi 2,2,.TOC.-0b@l
++ .localentry ML_(do_syscall_for_client_WRK), .-ML_(do_syscall_for_client_WRK)
++#endif
+ .type .ML_(do_syscall_for_client_WRK),@function
+ .globl .ML_(do_syscall_for_client_WRK)
+ .ML_(do_syscall_for_client_WRK):
+@@ -145,7 +158,9 @@ ML_(do_syscall_for_client_WRK):
+ /* failure: return 0x8000 | error code */
+ 7: ori 3,3,0x8000 /* FAILURE -- ensure return value is nonzero */
+ b 5b
+-
++#if _CALL_ELF == 2
++ .size .ML_(do_syscall_for_client_WRK),.-.ML_(do_syscall_for_client_WRK)
++#endif
+ .section .rodata
+ /* export the ranges so that
+ VG_(fixup_guest_state_after_syscall_interrupted) can do the
+diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c
+index 6549dd1b3..4ecbe38a6 100644
+--- a/coregrind/m_syswrap/syswrap-ppc64-linux.c
++++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c
+@@ -41,6 +41,7 @@
+ #include "pub_core_libcprint.h"
+ #include "pub_core_libcproc.h"
+ #include "pub_core_libcsignal.h"
++#include "pub_core_machine.h"
+ #include "pub_core_options.h"
+ #include "pub_core_scheduler.h"
+ #include "pub_core_sigframe.h" // For VG_(sigframe_destroy)()
+@@ -76,7 +77,8 @@ void ML_(call_on_new_stack_0_1) ( Addr stack,
+ address, the second word is the TOC ptr (r2), and the third word is
+ the static chain value. */
+ asm(
+-#if defined(VGP_ppc64be_linux)
++#if (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && defined(VG_PLAT_USES_PPCTOC)
+ " .align 2\n"
+ " .globl vgModuleLocal_call_on_new_stack_0_1\n"
+ " .section \".opd\",\"aw\"\n"
+@@ -126,7 +128,7 @@ asm(
+ " bctr\n\t" // jump to dst
+ " trap\n" // should never get here
+ #else
+-// ppc64le_linux
++// ppc64 ELFv2 Linux
+ " .align 2\n"
+ " .globl vgModuleLocal_call_on_new_stack_0_1\n"
+ "vgModuleLocal_call_on_new_stack_0_1:\n"
+@@ -211,7 +213,8 @@ asm(
+
+ // See priv_syswrap-linux.h for arg profile.
+ asm(
+-#if defined(VGP_ppc64be_linux)
++#if (defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)) \
++ && defined(VG_PLAT_USES_PPCTOC)
+ " .align 2\n"
+ " .globl do_syscall_clone_ppc64_linux\n"
+ " .section \".opd\",\"aw\"\n"
+diff --git a/coregrind/m_trampoline.S b/coregrind/m_trampoline.S
+index 0488b54bd..d00916aef 100644
+--- a/coregrind/m_trampoline.S
++++ b/coregrind/m_trampoline.S
+@@ -469,11 +469,11 @@ VG_(ppctoc_magic_redirect_return_stub):
+ .align 2
+ .globl VG_(ppc64_linux_REDIR_FOR_strlen)
+ #if !defined VGP_ppc64be_linux || _CALL_ELF == 2
+- /* Little Endian uses ELF version 2 */
++ /* ELF version 2 */
+ .type VG_(ppc64_linux_REDIR_FOR_strlen),@function
+ VG_(ppc64_linux_REDIR_FOR_strlen):
+ #else
+- /* Big Endian uses ELF version 1 */
++ /* ELF version 1 */
+ .section ".opd","aw"
+ .align 3
+ VG_(ppc64_linux_REDIR_FOR_strlen):
+diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c
+index 3602a4663..bdd1d50ee 100644
+--- a/coregrind/m_translate.c
++++ b/coregrind/m_translate.c
+@@ -1006,7 +1006,8 @@ static IRExpr* mkU32 ( UInt n ) {
+ return IRExpr_Const(IRConst_U32(n));
+ }
+
+-#if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64le_linux)
++#if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64be_linux) \
++ || defined(VGP_ppc64le_linux)
+ static IRExpr* mkU8 ( UChar n ) {
+ return IRExpr_Const(IRConst_U8(n));
+ }
+@@ -1234,7 +1234,8 @@ static void gen_push_and_set_LR_R2 ( IRSB* bb, Addr new_R2_value )
+ }
+ #endif
+
+-#if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64le_linux)
++#if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64be_linux) \
++ || defined(VGP_ppc64le_linux)
+
+ static void gen_pop_R2_LR_then_bLR ( IRSB* bb )
+ {
+@@ -1263,7 +1264,8 @@ static void gen_pop_R2_LR_then_bLR ( IRSB* bb )
+ }
+ #endif
+
+-#if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64le_linux)
++#if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64be_linux) \
++ || defined(VGP_ppc64le_linux)
+
+ static
+ Bool mk_preamble__ppctoc_magic_return_stub ( void* closureV, IRSB* bb )
+@@ -1285,7 +1287,7 @@ Bool mk_preamble__ppctoc_magic_return_stub ( void* closureV, IRSB* bb )
+ }
+ #endif
+
+-#if defined(VGP_ppc64le_linux)
++#if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
+ /* Generate code to push LR and R2 onto this thread's redir stack.
+ Need to save R2 in case we redirect to a global entry point. The
+ value of R2 is not preserved when entering the global entry point.
+@@ -1366,9 +1368,7 @@ Bool mk_preamble__set_NRADDR_to_zero ( void* closureV, IRSB* bb )
+ gen_push_and_set_LR_R2 ( bb, VG_(get_tocptr)( VG_(current_DiEpoch)(),
+ closure->readdr ) );
+ }
+-# endif
+-
+-#if defined(VGP_ppc64le_linux)
++#elif defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
+ VgCallbackClosure* closure = (VgCallbackClosure*)closureV;
+ Int offB_GPR12 = offsetof(VexGuestArchState, guest_GPR12);
+ addStmtToIRSB(bb, IRStmt_Put(offB_GPR12, mkU64(closure->readdr)));
+@@ -1424,7 +1424,6 @@ Bool mk_preamble__set_NRADDR_to_nraddr ( void* closureV, IRSB* bb )
+ );
+ gen_push_and_set_LR_R2 ( bb, VG_(get_tocptr)( closure->readdr ) );
+-# endif
+-#if defined(VGP_ppc64le_linux)
++#elif defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
+ /* This saves the r2 before leaving the function. We need to move
+ * guest_NRADDR_GPR2 back to R2 on return.
+ */
+@@ -1648,7 +1647,8 @@ Bool VG_(translate) ( ThreadId tid,
+ preamble_fn = mk_preamble__set_NRADDR_to_nraddr;
+
+ /* LE we setup the LR */
+-# if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64le_linux)
++# if defined(VG_PLAT_USES_PPCTOC) || defined(VGP_ppc64be_linux) \
++ || defined(VGP_ppc64le_linux)
+ if (nraddr == (Addr)&VG_(ppctoc_magic_redirect_return_stub)) {
+ /* If entering the special return stub, this means a wrapped or
+ redirected function is returning. Make this translation one
+@@ -1692,13 +1692,14 @@ Bool VG_(translate) ( ThreadId tid,
+ vex_abiinfo.guest_ppc_zap_RZ_at_bl = NULL;
+ # endif
+
+-# if defined(VGP_ppc64be_linux)
++# if defined(VGP_ppc64be_linux) && defined(VG_PLAT_USES_PPCTOC)
+ vex_abiinfo.guest_ppc_zap_RZ_at_blr = True;
+ vex_abiinfo.guest_ppc_zap_RZ_at_bl = const_True;
+ vex_abiinfo.host_ppc_calls_use_fndescrs = True;
+ # endif
+
+-# if defined(VGP_ppc64le_linux)
++# if (defined(VGP_ppc64be_linux) && !defined(VG_PLAT_USES_PPCTOC)) \
++ || defined(VGP_ppc64le_linux)
+ vex_abiinfo.guest_ppc_zap_RZ_at_blr = True;
+ vex_abiinfo.guest_ppc_zap_RZ_at_bl = const_True;
+ vex_abiinfo.host_ppc_calls_use_fndescrs = False;
+diff --git a/coregrind/m_ume/elf.c b/coregrind/m_ume/elf.c
+index 21eb52bcb..f1e6b4728 100644
+--- a/coregrind/m_ume/elf.c
++++ b/coregrind/m_ume/elf.c
+@@ -847,8 +847,8 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info)
+ info->exe_base = minaddr + ebase;
+ info->exe_end = maxaddr + ebase;
+
+-#if defined(VGP_ppc64be_linux)
+- /* On PPC64BE, ELF ver 1, a func ptr is represented by a TOC entry ptr.
++#if defined(VGP_ppc64be_linux) && defined(VG_PLAT_USES_PPCTOC)
++ /* On PPC64, ELF ver 1, a func ptr is represented by a TOC entry ptr.
+ This TOC entry contains three words; the first word is the function
+ address, the second word is the TOC ptr (r2), and the third word
+ is the static chain value. */
+@@ -856,8 +856,8 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info)
+ info->init_toc = ((ULong*)entry)[1];
+ info->init_ip += info->interp_offset;
+ info->init_toc += info->interp_offset;
+-#elif defined(VGP_ppc64le_linux)
+- /* On PPC64LE, ELF ver 2. API doesn't use a func ptr */
++#elif defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
++ /* On PPC64, ELF ver 2. API doesn't use a func ptr */
+ info->init_ip = (Addr)entry;
+ info->init_toc = 0; /* meaningless on this platform */
+ #else
+diff --git a/coregrind/pub_core_machine.h b/coregrind/pub_core_machine.h
+index d6af843df..400148d57 100644
+--- a/coregrind/pub_core_machine.h
++++ b/coregrind/pub_core_machine.h
+@@ -60,12 +60,20 @@
+ # define VG_ELF_DATA2XXX ELFDATA2MSB
+ # define VG_ELF_MACHINE EM_PPC64
+ # define VG_ELF_CLASS ELFCLASS64
+-# define VG_PLAT_USES_PPCTOC 1
++# if !defined(_CALL_ELF) || _CALL_ELF == 1
++# define VG_PLAT_USES_PPCTOC 1
++# else
++# undef VG_PLAT_USES_PPCTOC
++# endif
+ #elif defined(VGP_ppc64le_linux)
+ # define VG_ELF_DATA2XXX ELFDATA2LSB
+ # define VG_ELF_MACHINE EM_PPC64
+ # define VG_ELF_CLASS ELFCLASS64
+-# undef VG_PLAT_USES_PPCTOC
++# if defined(_CALL_ELF) && _CALL_ELF == 1
++# define VG_PLAT_USES_PPCTOC 1
++# else // assume ELFv2 by default if no ABI is specified
++# undef VG_PLAT_USES_PPCTOC
++# endif
+ #elif defined(VGP_arm_linux)
+ # define VG_ELF_DATA2XXX ELFDATA2LSB
+ # define VG_ELF_MACHINE EM_ARM
+diff --git a/coregrind/vg_preloaded.c b/coregrind/vg_preloaded.c
+index ad033432a..f300fbe80 100644
+--- a/coregrind/vg_preloaded.c
++++ b/coregrind/vg_preloaded.c
+@@ -45,6 +45,7 @@
+ #include "pub_core_basics.h"
+ #include "pub_core_clreq.h"
+ #include "pub_core_debuginfo.h" // Needed for pub_core_redir.h
++#include "pub_core_machine.h" // For VG_PLAT_USES_PPCTOC
+ #include "pub_core_redir.h" // For VG_NOTIFY_ON_LOAD
+
+ #if defined(VGO_linux) || defined(VGO_solaris)
+@@ -103,7 +104,7 @@ void * VG_NOTIFY_ON_LOAD(ifunc_wrapper) (void)
+ VALGRIND_GET_ORIG_FN(fn);
+ CALL_FN_W_v(result, fn);
+
+-#if defined(VGP_ppc64be_linux)
++#if defined(VGP_ppc64be_linux) && defined(VG_PLAT_USES_PPCTOC)
+ /* ppc64be uses function descriptors, so get the actual function entry
+ address for the client request, but return the function descriptor
+ from this function.
+diff --git a/include/valgrind.h b/include/valgrind.h
+index 577c8f05e..99e058ccf 100644
+--- a/include/valgrind.h
++++ b/include/valgrind.h
+@@ -143,12 +143,20 @@
+ # define PLAT_amd64_linux 1
+ #elif defined(__linux__) && defined(__powerpc__) && !defined(__powerpc64__)
+ # define PLAT_ppc32_linux 1
+-#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__) && _CALL_ELF != 2
+-/* Big Endian uses ELF version 1 */
++#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__) && defined(__BIG_ENDIAN__)
+ # define PLAT_ppc64be_linux 1
+-#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__) && _CALL_ELF == 2
+-/* Little Endian uses ELF version 2 */
++# if _CALL_ELF == 2
++# define PLAT_ppc64_linux_abi2
++# else
++# define PLAT_ppc64_linux_abi1
++# endif
++#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__) && !defined(__BIG_ENDIAN__)
+ # define PLAT_ppc64le_linux 1
++# if _CALL_ELF == 2
++# define PLAT_ppc64_linux_abi2
++# else
++# define PLAT_ppc64_linux_abi1
++# endif
+ #elif defined(__linux__) && defined(__arm__) && !defined(__aarch64__)
+ # define PLAT_arm_linux 1
+ #elif defined(__linux__) && defined(__aarch64__) && !defined(__arm__)
+diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c
+index 782244481..c239f5b10 100644
+--- a/memcheck/mc_leakcheck.c
++++ b/memcheck/mc_leakcheck.c
+@@ -653,7 +653,7 @@ static Bool aligned_ptr_above_page0_is_vtable_addr(Addr ptr)
+ if (pot_fn == 0)
+ continue; // NULL fn pointer. Seems it can happen in vtable.
+ seg = VG_(am_find_nsegment) (pot_fn);
+-#if defined(VGA_ppc64be)
++#if defined(VGA_ppc64be) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
+ // ppc64BE uses a thunk table (function descriptors), so we have one
+ // more level of indirection to follow.
+ if (seg == NULL
+diff --git a/memcheck/mc_machine.c b/memcheck/mc_machine.c
+index 5ed101fca..70c64b361 100644
+--- a/memcheck/mc_machine.c
++++ b/memcheck/mc_machine.c
+@@ -132,7 +132,8 @@ static Int get_otrack_shadow_offset_wrk ( Int offset, Int szB )
+ return GOF(GPRn);
+ by testing ox instead of o, and setting ox back 4 bytes when sz == 4.
+ */
+-#if defined(VGA_ppc64le)
++#if (defined(VGA_ppc64be) && (defined(_CALL_ELF) && _CALL_ELF == 2)) \
++ || defined(VGA_ppc64le)
+ Int ox = o;
+ #else
+ Int ox = sz == 8 ? o : (o - 4);
+--
+2.18.0
+
diff --git a/user/valgrind/APKBUILD b/user/valgrind/APKBUILD
index 58ed29fa1..fcbd838d2 100644
--- a/user/valgrind/APKBUILD
+++ b/user/valgrind/APKBUILD
@@ -1,12 +1,12 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=valgrind
pkgver=3.13.0
-pkgrel=1
+pkgrel=3
pkgdesc="A tool to help find memory-management problems in programs"
url="http://valgrind.org/"
arch="all"
license="GPL-2.0+"
-makedepends="autoconf automake libtool bash perl"
+makedepends="autoconf automake libtool bash perl cmd:which"
# from README_PACKAGERS:
# Don't strip the debug info off lib/valgrind/$platform/vgpreload*.so
# in the installation tree. Either Valgrind won't work at all, or it
@@ -17,9 +17,9 @@ subpackages="$pkgname-dev $pkgname-doc"
source="ftp://sourceware.org/pub/$pkgname/$pkgname-$pkgver.tar.bz2
uclibc.patch
arm.patch
- coregrind-elfv2.patch"
+ 0001-Ensure-ELFv2-is-supported-on-PPC64.patch
+ "
# musl-fixes.patch
-builddir="$srcdir"/$pkgname-$pkgver
prepare() {
default_prepare
@@ -67,4 +67,4 @@ package() {
sha512sums="34e1013cd3815d30a459b86220e871bb0a6209cc9e87af968f347083693779f022e986f211bdf1a5184ad7370cde12ff2cfca8099967ff94732970bd04a97009 valgrind-3.13.0.tar.bz2
d59a10db9037e120df2ee94a103402ca95a79abee9d8be63e4e1bca29c82dca775cc402a79b854ec11a2160a4d2da202c237369418e221d1925267ea2613fd5d uclibc.patch
9ee297d1b2b86891584443ad0caadc4977e1447979611ccf1cc55dbee61911b0b063bc4ad936d86c451cedae410cb3219b5a088b2ad0aa17df182d564fe36cfe arm.patch
-0f54b7b207870f495a0cf010b3091e2c0626bbf93b8a5ba7956b690981d4186de61f3e3b1fdc3aec2dfcacb69e712900f32c883a09dd4733c1e4569506272520 coregrind-elfv2.patch"
+71afb12748f69f0976a299c65572818b70cbce5d04f230a49a50f114351d8083c59a9e197cefbcb9145806797ff4d1d54488f50342b680c9a2b76e4a7f7cf305 0001-Ensure-ELFv2-is-supported-on-PPC64.patch"
diff --git a/user/valgrind/coregrind-elfv2.patch b/user/valgrind/coregrind-elfv2.patch
deleted file mode 100644
index 7e4a2d636..000000000
--- a/user/valgrind/coregrind-elfv2.patch
+++ /dev/null
@@ -1,443 +0,0 @@
-The LE and BE code here is the same, except the BE has the old-style
-function descriptor. So, we use the LE code on ELFv2 to fix build errors.
-
---- valgrind-3.13.0/coregrind/m_libcsetjmp.c 2017-05-31 10:14:45.000000000 -0500
-+++ valgrind-3.13.0/coregrind/m_libcsetjmp.c 2018-05-25 20:07:37.007835735 -0500
-@@ -149,7 +149,7 @@
-
- /* ------------ ppc64-linux ------------ */
-
--#if defined(VGP_ppc64be_linux)
-+#if defined(VGP_ppc64be_linux) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
-
- __asm__(
- ".section \".toc\",\"aw\"" "\n"
-@@ -268,7 +268,8 @@
- ".previous" "\n"
- );
-
--#elif defined(VGP_ppc64le_linux)
-+#elif (defined(VGP_ppc64le_linux)) || \
-+ (defined(VGP_ppc64be_linux) && defined(_CALL_ELF) && _CALL_ELF == 2)
- __asm__(
- ".section \".toc\",\"aw\"" "\n"
-
---- valgrind-3.13.0/coregrind/m_main.c.old 2017-05-31 10:14:52.000000000 -0500
-+++ valgrind-3.13.0/coregrind/m_main.c 2018-05-30 19:01:00.534083618 -0500
-@@ -2585,7 +2585,7 @@
- "\ttrap\n"
- ".previous\n"
- );
--#elif defined(VGP_ppc64be_linux)
-+#elif defined(VGP_ppc64be_linux) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
- asm("\n"
- /* PPC64 ELF ABI says '_start' points to a function descriptor.
- So we must have one, and that is what goes into the .opd section. */
-@@ -2631,9 +2631,9 @@
- "\tnop\n"
- "\ttrap\n"
- );
--#elif defined(VGP_ppc64le_linux)
--/* Little Endian uses ELF version 2 but in the future may also
-- * support other ELF versions.
-+#elif defined(VGP_ppc64le_linux) || \
-+ (defined(VGP_ppc64be_linux) && defined(_CALL_ELF) && _CALL_ELF == 2)
-+/* PowerPC 64 ELF version 2 does not use function descriptors.
- */
- asm("\n"
- "\t.align 2\n"
---- valgrind-3.13.0/coregrind/m_syscall.c.old 2017-05-31 10:14:29.000000000 -0500
-+++ valgrind-3.13.0/coregrind/m_syscall.c 2018-05-30 19:02:00.984023769 -0500
-@@ -470,7 +470,7 @@
- ".previous\n"
- );
-
--#elif defined(VGP_ppc64be_linux)
-+#elif defined(VGP_ppc64be_linux) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
- /* Due to the need to return 65 bits of result, this is completely
- different from the ppc32 case. The single arg register points to a
- 7-word block containing the syscall # and the 6 args. The syscall
-@@ -506,7 +506,8 @@
- " blr\n"
- );
-
--#elif defined(VGP_ppc64le_linux)
-+#elif defined(VGP_ppc64le_linux) || \
-+ (defined(VGP_ppc64be_linux) && defined(_CALL_ELF) && _CALL_ELF == 2)
- /* Due to the need to return 65 bits of result, this is completely
- different from the ppc32 case. The single arg register points to a
- 7-word block containing the syscall # and the 6 args. The syscall
---- valgrind-3.13.0/coregrind/m_signals.c.old 2017-05-31 10:14:52.000000000 -0500
-+++ valgrind-3.13.0/coregrind/m_signals.c 2018-05-30 22:12:46.082692356 -0500
-@@ -889,7 +889,7 @@
- " sc\n" \
- ".previous\n"
-
--#elif defined(VGP_ppc64be_linux)
-+#elif defined(VGP_ppc64be_linux) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
- # define _MY_SIGRETURN(name) \
- ".align 2\n" \
- ".globl my_sigreturn\n" \
-@@ -904,7 +904,8 @@
- " li 0, " #name "\n" \
- " sc\n"
-
--#elif defined(VGP_ppc64le_linux)
-+#elif defined(VGP_ppc64le_linux) || \
-+ (defined(VGP_ppc64be_linux) && defined(_CALL_ELF) && _CALL_ELF == 2)
- /* Little Endian supports ELF version 2. In the future, it may
- * support other versions.
- */
---- valgrind-3.13.0/coregrind/m_syswrap/syswrap-ppc64-linux.c.old 2017-05-31 10:14:39.000000000 -0500
-+++ valgrind-3.13.0/coregrind/m_syswrap/syswrap-ppc64-linux.c 2018-05-30 22:15:42.112518074 -0500
-@@ -71,12 +71,12 @@
- // r4 = retaddr
- // r5 = function descriptor
- // r6 = arg1
--/* On PPC64, a func ptr is represented by a TOC entry ptr.
-+/* On ELFv1, a func ptr is represented by a TOC entry ptr.
- This TOC entry contains three words; the first word is the function
- address, the second word is the TOC ptr (r2), and the third word is
- the static chain value. */
- asm(
--#if defined(VGP_ppc64be_linux)
-+#if defined(VGP_ppc64be_linux) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
- " .align 2\n"
- " .globl vgModuleLocal_call_on_new_stack_0_1\n"
- " .section \".opd\",\"aw\"\n"
-@@ -126,7 +126,7 @@
- " bctr\n\t" // jump to dst
- " trap\n" // should never get here
- #else
--// ppc64le_linux
-+// ppc64le_linux, or ELFv2 ABI on BE
- " .align 2\n"
- " .globl vgModuleLocal_call_on_new_stack_0_1\n"
- "vgModuleLocal_call_on_new_stack_0_1:\n"
-@@ -211,7 +211,7 @@
-
- // See priv_syswrap-linux.h for arg profile.
- asm(
--#if defined(VGP_ppc64be_linux)
-+#if defined(VGP_ppc64be_linux) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
- " .align 2\n"
- " .globl do_syscall_clone_ppc64_linux\n"
- " .section \".opd\",\"aw\"\n"
---- valgrind-3.13.0/coregrind/m_syswrap/syscall-ppc64be-linux.S.old 2017-05-31 10:14:39.000000000 -0500
-+++ valgrind-3.13.0/coregrind/m_syswrap/syscall-ppc64be-linux.S 2018-05-30 22:18:31.742350130 -0500
-@@ -29,7 +29,7 @@
-
- #include "pub_core_basics_asm.h"
-
--#if defined(VGP_ppc64be_linux)
-+#if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
-
- #include "pub_core_vkiscnums_asm.h"
- #include "libvex_guest_offsets.h"
-@@ -76,12 +76,25 @@
-
- .align 2
- .globl ML_(do_syscall_for_client_WRK)
-+#if _CALL_ELF == 2
-+.type .ML_(do_syscall_for_client_WRK),@function
-+ML_(do_syscall_for_client_WRK):
-+0: addis 2,12,.TOC.-0b@ha
-+ addi 2,2,.TOC.-0b@l
-+ .localentry ML_(do_syscall_for_client_WRK), .-ML_(do_syscall_for_client_WRK)
-+#else
- .section ".opd","aw"
- .align 3
--ML_(do_syscall_for_client_WRK):
-+ML_(do_syscall_for_client_WRK):
- .quad .ML_(do_syscall_for_client_WRK),.TOC.@tocbase,0
- .previous
--.type .ML_(do_syscall_for_client_WRK),@function
-+#endif
-+#if _CALL_ELF == 2
-+0: addis 2,12,.TOC.-0b@ha
-+ addi 2,2,.TOC.-0b@l
-+ .localentry ML_(do_syscall_for_client_WRK), .-ML_(do_syscall_for_client_WRK)
-+#endif
-+.type .ML_(do_syscall_for_client_WRK),@function
- .globl .ML_(do_syscall_for_client_WRK)
- .ML_(do_syscall_for_client_WRK):
- /* make a stack frame */
-@@ -145,7 +158,11 @@
- /* failure: return 0x8000 | error code */
- 7: ori 3,3,0x8000 /* FAILURE -- ensure return value is nonzero */
- b 5b
--
-+#if _CALL_ELF == 2
-+ .size .ML_(do_syscall_for_client_WRK),.-.ML_(do_syscall_for_client_WRK)
-+#else
-+ .size .ML_(do_syscall_for_client_WRK),.-.ML_(do_syscall_for_client_WRK)
-+#endif
- .section .rodata
- /* export the ranges so that
- VG_(fixup_guest_state_after_syscall_interrupted) can do the
-@@ -162,7 +179,7 @@
- ML_(blksys_committed): .quad 4b
- ML_(blksys_finished): .quad 5b
-
--#endif // defined(VGP_ppc64be_linux)
-+#endif // defined(VGP_ppc64le_linux)
-
- /* Let the linker know we don't need an executable stack */
- MARK_STACK_NO_EXEC
---- valgrind-3.13.0/coregrind/m_dispatch/dispatch-ppc64be-linux.S.old 2017-05-31 10:14:33.000000000 -0500
-+++ valgrind-3.13.0/coregrind/m_dispatch/dispatch-ppc64be-linux.S 2018-05-30 22:39:37.951096498 -0500
-@@ -30,12 +30,21 @@
-
- #include "pub_core_basics_asm.h"
-
--#if defined(VGP_ppc64be_linux)
-+#if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
-
- #include "pub_core_dispatch_asm.h"
- #include "pub_core_transtab_asm.h"
- #include "libvex_guest_offsets.h" /* for OFFSET_ppc64_CIA */
-
-+/* NOTE: PPC64 supports Big Endian and Little Endian. It also supports the
-+ ELF version 1 and ELF version 2 APIs.
-+
-+ Currently LE uses ELF version 2 and BE uses ELF version 1. However,
-+ BE and LE may support the other ELF version in the future. So, the
-+ _CALL_ELF is used in the assembly function to enable code for a
-+ specific ELF version independently of the endianness of the machine.
-+ The test "#if _CALL_ELF == 2" checks if ELF version 2 is being used.
-+*/
-
- /* References to globals via the TOC */
-
-@@ -75,14 +84,26 @@
- .section ".text"
- .align 2
- .globl VG_(disp_run_translations)
-+#if _CALL_ELF == 2
-+.type VG_(disp_run_translations),@function
-+VG_(disp_run_translations):
-+.type .VG_(disp_run_translations),@function
-+#else
- .section ".opd","aw"
- .align 3
- VG_(disp_run_translations):
- .quad .VG_(disp_run_translations),.TOC.@tocbase,0
- .previous
- .type .VG_(disp_run_translations),@function
-+#endif
- .globl .VG_(disp_run_translations)
- .VG_(disp_run_translations):
-+#if _CALL_ELF == 2
-+0: addis 2, 12,.TOC.-0b@ha
-+ addi 2,2,.TOC.-0b@l
-+ .localentry VG_(disp_run_translations), .-VG_(disp_run_translations)
-+#endif
-+
- /* r3 holds two_words */
- /* r4 holds guest_state */
- /* r5 holds host_addr */
-@@ -229,8 +250,13 @@
- /* make a stack frame for the code we are calling */
- stdu 1,-48(1)
-
-- /* Set up the guest state ptr */
-+ /* Set up the guest state ptr */
- mr 31,4 /* r31 (generated code gsp) = r4 */
-+#if _CALL_ELF == 2
-+/* for the LE ABI need to setup r2 and r12 */
-+0: addis 2, 12,.TOC.-0b@ha
-+ addi 2,2,.TOC.-0b@l
-+#endif
-
- /* and jump into the code cache. Chained translations in
- the code cache run, until for whatever reason, they can't
-@@ -385,6 +411,9 @@
- mtlr 0
- addi 1,1,624 /* stack_size */
- blr
-+#if _CALL_ELF == 2
-+ .size VG_(disp_run_translations),.-VG_(disp_run_translations)
-+#endif
-
-
- /*----------------------------------------------------*/
-@@ -395,15 +424,25 @@
- .section ".text"
- .align 2
- .globl VG_(disp_cp_chain_me_to_slowEP)
-- .section ".opd","aw"
-+#if _CALL_ELF == 2
-+ .type VG_(disp_cp_chain_me_to_slowEP),@function
-+ VG_(disp_cp_chain_me_to_slowEP):
-+#else
-+ .section ".opd","aw"
- .align 3
- VG_(disp_cp_chain_me_to_slowEP):
- .quad .VG_(disp_cp_chain_me_to_slowEP),.TOC.@tocbase,0
- .previous
-+#endif
- .type .VG_(disp_cp_chain_me_to_slowEP),@function
- .globl .VG_(disp_cp_chain_me_to_slowEP)
- .VG_(disp_cp_chain_me_to_slowEP):
-- /* We got called. The return address indicates
-+#if _CALL_ELF == 2
-+0: addis 2, 12,.TOC.-0b@ha
-+ addi 2,2,.TOC.-0b@l
-+ .localentry VG_(disp_cp_chain_me_to_slowEP), .-VG_(disp_cp_chain_me_to_slowEP)
-+#endif
-+ /* We got called. The return address indicates
- where the patching needs to happen. Collect
- the return address and, exit back to C land,
- handing the caller the pair (Chain_me_S, RA) */
-@@ -415,20 +454,33 @@
- */
- subi 7,7,20+4+4
- b .postamble
-+#if _CALL_ELF == 2
-+ .size VG_(disp_cp_chain_me_to_slowEP),.-VG_(disp_cp_chain_me_to_slowEP)
-+#endif
-
- /* ------ Chain me to fast entry point ------ */
- .section ".text"
- .align 2
- .globl VG_(disp_cp_chain_me_to_fastEP)
-- .section ".opd","aw"
-+#if _CALL_ELF == 2
-+ .type VG_(disp_cp_chain_me_to_fastEP),@function
-+VG_(disp_cp_chain_me_to_fastEP):
-+#else
-+ .section ".opd","aw"
- .align 3
- VG_(disp_cp_chain_me_to_fastEP):
- .quad .VG_(disp_cp_chain_me_to_fastEP),.TOC.@tocbase,0
- .previous
-+#endif
- .type .VG_(disp_cp_chain_me_to_fastEP),@function
- .globl .VG_(disp_cp_chain_me_to_fastEP)
- .VG_(disp_cp_chain_me_to_fastEP):
-- /* We got called. The return address indicates
-+#if _CALL_ELF == 2
-+0: addis 2, 12,.TOC.-0b@ha
-+ addi 2,2,.TOC.-0b@l
-+ .localentry VG_(disp_cp_chain_me_to_fastEP), .-VG_(disp_cp_chain_me_to_fastEP)
-+#endif
-+ /* We got called. The return address indicates
- where the patching needs to happen. Collect
- the return address and, exit back to C land,
- handing the caller the pair (Chain_me_S, RA) */
-@@ -440,20 +492,33 @@
- */
- subi 7,7,20+4+4
- b .postamble
-+#if _CALL_ELF == 2
-+ .size VG_(disp_cp_chain_me_to_fastEP),.-VG_(disp_cp_chain_me_to_fastEP)
-+#endif
-
- /* ------ Indirect but boring jump ------ */
- .section ".text"
- .align 2
- .globl VG_(disp_cp_xindir)
-- .section ".opd","aw"
-+#if _CALL_ELF == 2
-+ .type VG_(disp_cp_xindir),@function
-+VG_(disp_cp_xindir):
-+#else
-+ .section ".opd","aw"
- .align 3
- VG_(disp_cp_xindir):
- .quad .VG_(disp_cp_xindir),.TOC.@tocbase,0
- .previous
-+#endif
- .type .VG_(disp_cp_xindir),@function
- .globl .VG_(disp_cp_xindir)
- .VG_(disp_cp_xindir):
-- /* Where are we going? */
-+#if _CALL_ELF == 2
-+0: addis 2, 12,.TOC.-0b@ha
-+ addi 2,2,.TOC.-0b@l
-+ .localentry VG_(disp_cp_xindir), .-VG_(disp_cp_xindir)
-+#endif
-+ /* Where are we going? */
- ld 3,OFFSET_ppc64_CIA(31)
-
- /* stats only */
-@@ -479,6 +544,9 @@
- /* Found a match. Jump to .host. */
- mtctr 7
- bctr
-+#if _CALL_ELF == 2
-+ .size VG_(disp_cp_xindir),.-VG_(disp_cp_xindir)
-+#endif
-
- .fast_lookup_failed:
- /* stats only */
-@@ -496,39 +564,64 @@
- .section ".text"
- .align 2
- .globl VG_(disp_cp_xassisted)
-- .section ".opd","aw"
-+#if _CALL_ELF == 2
-+ .type VG_(disp_cp_xassisted),@function
-+VG_(disp_cp_xassisted):
-+#else
-+ .section ".opd","aw"
- .align 3
- VG_(disp_cp_xassisted):
- .quad .VG_(disp_cp_xassisted),.TOC.@tocbase,0
- .previous
-- .type .VG_(disp_cp_xassisted),@function
-+#endif
-+#if _CALL_ELF == 2
-+0: addis 2, 12,.TOC.-0b@ha
-+ addi 2,2,.TOC.-0b@l
-+ .localentry VG_(disp_cp_xassisted), .-VG_(disp_cp_xassisted)
-+#endif
-+ .type .VG_(disp_cp_xassisted),@function
- .globl .VG_(disp_cp_xassisted)
- .VG_(disp_cp_xassisted):
- /* r31 contains the TRC */
- mr 6,31
- li 7,0
- b .postamble
-+#if _CALL_ELF == 2
-+ .size VG_(disp_cp_xassisted),.-VG_(disp_cp_xassisted)
-+#endif
-
- /* ------ Event check failed ------ */
- .section ".text"
- .align 2
- .globl VG_(disp_cp_evcheck_fail)
-- .section ".opd","aw"
-+#if _CALL_ELF == 2
-+ .type VG_(disp_cp_evcheck_fail),@function
-+VG_(disp_cp_evcheck_fail):
-+#else
-+ .section ".opd","aw"
- .align 3
- VG_(disp_cp_evcheck_fail):
- .quad .VG_(disp_cp_evcheck_fail),.TOC.@tocbase,0
- .previous
-+#endif
-+#if _CALL_ELF == 2
-+0: addis 2, 12,.TOC.-0b@ha
-+ addi 2,2,.TOC.-0b@l
-+ .localentry VG_(disp_cp_evcheck_fail), .-VG_(disp_cp_evcheck_fail)
-+#endif
- .type .VG_(disp_cp_evcheck_fail),@function
- .globl .VG_(disp_cp_evcheck_fail)
- .VG_(disp_cp_evcheck_fail):
- li 6,VG_TRC_INNER_COUNTERZERO
- li 7,0
- b .postamble
-+#if _CALL_ELF == 2
-+ .size VG_(disp_cp_evcheck_fail),.-VG_(disp_cp_evcheck_fail)
-+#endif
-
--
- .size .VG_(disp_run_translations), .-.VG_(disp_run_translations)
-
--#endif // defined(VGP_ppc64be_linux)
-+#endif // defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
-
- /* Let the linker know we don't need an executable stack */
- MARK_STACK_NO_EXEC
diff --git a/user/vlc/APKBUILD b/user/vlc/APKBUILD
index dea31e948..7db6632a1 100644
--- a/user/vlc/APKBUILD
+++ b/user/vlc/APKBUILD
@@ -3,7 +3,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=vlc
pkgver=3.0.4
-pkgrel=0
+pkgrel=1
pkgdesc="Multi-platform MPEG, VCD/DVD, and DivX player"
triggers="vlc-libs.trigger=/usr/lib/vlc/plugins"
pkgusers="vlc"