Go to file
Fangrui Song 82442adfc0 [PPC32] Improve the 32-bit PowerPC port
Many -static/-no-pie/-shared/-pie applications linked against glibc or musl
should work with this patch. This also helps FreeBSD PowerPC64 to migrate
their lib32 (PR40888).

* Fix default image base and max page size.
* Support new-style Secure PLT (see below). Old-style BSS PLT is not
  implemented, so it is not suitable for FreeBSD rtld now because it doesn't
  support Secure PLT yet.
* Support more initial relocation types:
  R_PPC_ADDR32, R_PPC_REL16*, R_PPC_LOCAL24PC, R_PPC_PLTREL24, and R_PPC_GOT16.
  The addend of R_PPC_PLTREL24 is special: it decides the call stub PLT type
  but it should be ignored for the computation of target symbol VA.
* Support GNU ifunc
* Support .glink used for lazy PLT resolution in glibc
* Add a new thunk type: PPC32PltCallStub that is similar to PPC64PltCallStub.
  It is used by R_PPC_REL24 and R_PPC_PLTREL24.

A PLT stub used in -fPIE/-fPIC usually loads an address relative to
.got2+0x8000 (-fpie/-fpic code uses _GLOBAL_OFFSET_TABLE_ relative
addresses).
Two .got2 sections in two object files have different addresses, thus a PLT stub
can't be shared by two object files. To handle this incompatibility,
change the parameters of Thunk::isCompatibleWith to
`const InputSection &, const Relocation &`.

PowerPC psABI specified an old-style .plt (BSS PLT) that is both
writable and executable. Linkers don't make separate RW- and RWE segments,
which causes all initially writable memory (think .data) executable.
This is a big security concern so a new PLT scheme (secure PLT) was developed to
address the security issue.

TLS will be implemented in D62940.

glibc older than ~2012 requires .rela.dyn to include .rela.plt, it can
not handle the DT_RELA+DT_RELASZ == DT_JMPREL case correctly. A hack
(not included in this patch) in LinkerScript.cpp addOrphanSections() to
work around the issue:

    if (Config->EMachine == EM_PPC) {
      // Older glibc assumes .rela.dyn includes .rela.plt
      Add(In.RelaDyn);
      if (In.RelaPlt->isLive() && !In.RelaPlt->Parent)
        In.RelaDyn->getParent()->addSection(In.RelaPlt);
    }

Reviewed By: ruiu

Differential Revision: https://reviews.llvm.org/D62464

llvm-svn: 362721
2019-06-06 17:03:00 +00:00
clang [LibTooling] Add insert/remove convenience functions for creating `ASTEdit`s. 2019-06-06 14:20:29 +00:00
clang-tools-extra [clang-tidy] Another attempt to fix misc-redundant-expression check. 2019-06-06 13:43:38 +00:00
compiler-rt [Profile]: Add runtime interface to specify file handle for profile data (Part-II) 2019-06-06 16:29:44 +00:00
debuginfo-tests Add cdb test for inline line tables 2019-06-03 18:24:55 +00:00
libclc travis: Add LLVM-8 build 2019-03-27 21:28:31 +00:00
libcxx Revert "Speedup to_string and to_wstring for integers using stack buffer and SSO." 2019-06-06 07:51:39 +00:00
libcxxabi [libcxx] Use libtool when merging archives on Apple platforms 2019-06-02 01:14:31 +00:00
libunwind [Docs] Modernize references to macOS 2019-05-30 16:46:22 +00:00
lld [PPC32] Improve the 32-bit PowerPC port 2019-06-06 17:03:00 +00:00
lldb [NativeProcessDarwin] Remove dead code. NFCI. 2019-06-05 20:23:03 +00:00
llgo IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
llvm [NFC][CodeGen] Add unary fneg tests to X86/fma_patterns_wide.ll 2019-06-06 16:55:51 +00:00
openmp Added propagation of not big initial stack size of master thread to workers. 2019-06-05 16:14:47 +00:00
parallel-libs Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
polly [ScopBuilder] Move canonicalizeDynamicsBasePtrs from ScopInfo. NFC. 2019-06-04 21:58:54 +00:00
pstl [pstl] The optimized parallel versions of sort, stable_sort algorithms, TBB parallel backend. 2019-06-06 07:34:46 +00:00
.arcconfig Update monorepo .arcconfig with new project callsign. 2019-01-31 14:34:59 +00:00
.clang-format Add .clang-tidy and .clang-format files to the toplevel of the 2019-01-29 16:43:16 +00:00
.clang-tidy Disable tidy checks with too many hits 2019-02-01 11:20:13 +00:00
.gitignore Add a reduced copy of the llvm .gitignore 2019-04-09 00:52:49 +00:00
README.md

README.md

The LLVM Compiler Infrastructure

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.