r336710 - Fix a typo/regression in r335495.
Author: jhb Date: Tue Jul 10 10:44:08 2018 New Revision: 336710 URL: http://llvm.org/viewvc/llvm-project?rev=336710=rev Log: Fix a typo/regression in r335495. Use getTriple.isMIPS64() to detect 64-bit MIPS ABIs in FreeBSD::getSupportedSanitizers() instead of getTriple.isMIPS32(). Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D49143 Modified: cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp cfe/trunk/test/Driver/fsanitize.c Modified: cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp?rev=336710=336709=336710=diff == --- cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp Tue Jul 10 10:44:08 2018 @@ -408,7 +408,7 @@ bool FreeBSD::isPIEDefault() const { ret SanitizerMask FreeBSD::getSupportedSanitizers() const { const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; const bool IsX86_64 = getTriple().getArch() == llvm::Triple::x86_64; - const bool IsMIPS64 = getTriple().isMIPS32(); + const bool IsMIPS64 = getTriple().isMIPS64(); SanitizerMask Res = ToolChain::getSupportedSanitizers(); Res |= SanitizerKind::Address; Res |= SanitizerKind::Vptr; Modified: cfe/trunk/test/Driver/fsanitize.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=336710=336709=336710=diff == --- cfe/trunk/test/Driver/fsanitize.c (original) +++ cfe/trunk/test/Driver/fsanitize.c Tue Jul 10 10:44:08 2018 @@ -316,6 +316,12 @@ // RUN: %clang -target mips-unknown-linux -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL-MIPS // CHECK-SANL-MIPS: unsupported option '-fsanitize=leak' for target 'mips-unknown-linux' +// RUN: %clang -target mips-unknown-freebsd -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL-MIPS-FREEBSD +// CHECK-SANL-MIPS-FREEBSD: unsupported option '-fsanitize=leak' for target 'mips-unknown-freebsd' + +// RUN: %clang -target mips64-unknown-freebsd -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL-MIPS64-FREEBSD +// CHECK-SANL-MIPS64-FREEBSD: "-fsanitize=leak" + // RUN: %clang -target powerpc64-unknown-linux -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL-PPC64 // RUN: %clang -target powerpc64le-unknown-linux -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL-PPC64 // CHECK-SANL-PPC64: "-fsanitize=leak" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r335702 - Fix warning about unhandled enumeration in switch.
On 6/26/18 7:49 PM, Zachary Turner via cfe-commits wrote: > Author: zturner > Date: Tue Jun 26 19:49:22 2018 > New Revision: 335702 > > URL: http://llvm.org/viewvc/llvm-project?rev=335702=rev > Log: > Fix warning about unhandled enumeration in switch. > > Modified: > cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp > > Modified: cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp?rev=335702=335701=335702=diff > == > --- cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp (original) > +++ cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp Tue Jun 26 19:49:22 2018 > @@ -198,6 +198,8 @@ void freebsd::Linker::ConstructJob(Compi > else >CmdArgs.push_back("elf64ltsmip_fbsd"); > break; > + default: > +break; >} Thanks for fixing and apologies for the build breakage. :( -- John Baldwin ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335691 - [mips] Explicitly specify the linker emulation for MIPS on FreeBSD.
Author: jhb Date: Tue Jun 26 17:02:16 2018 New Revision: 335691 URL: http://llvm.org/viewvc/llvm-project?rev=335691=rev Log: [mips] Explicitly specify the linker emulation for MIPS on FreeBSD. FreeBSD's mips64 builds O32 binaries for /usr/lib32 by default and thus needs to be able to link O32 binaries which requires an explicit linker emulation. Go ahead and list all the linker emulation variants for MIPS so that any supported MIPS ABI binary can be linked by any linker supporting MIPS. Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D48507 Modified: cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp cfe/trunk/test/Driver/freebsd.c Modified: cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp?rev=335691=335690=335691=diff == --- cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp Tue Jun 26 17:02:16 2018 @@ -165,16 +165,39 @@ void freebsd::Linker::ConstructJob(Compi CmdArgs.push_back("--enable-new-dtags"); } - // When building 32-bit code on FreeBSD/amd64, we have to explicitly - // instruct ld in the base system to link 32-bit code. - if (Arch == llvm::Triple::x86) { + // Explicitly set the linker emulation for platforms that might not + // be the default emulation for the linker. + switch (Arch) { + case llvm::Triple::x86: CmdArgs.push_back("-m"); CmdArgs.push_back("elf_i386_fbsd"); - } - - if (Arch == llvm::Triple::ppc) { +break; + case llvm::Triple::ppc: CmdArgs.push_back("-m"); CmdArgs.push_back("elf32ppc_fbsd"); +break; + case llvm::Triple::mips: +CmdArgs.push_back("-m"); +CmdArgs.push_back("elf32btsmip_fbsd"); +break; + case llvm::Triple::mipsel: +CmdArgs.push_back("-m"); +CmdArgs.push_back("elf32ltsmip_fbsd"); +break; + case llvm::Triple::mips64: +CmdArgs.push_back("-m"); +if (tools::mips::hasMipsAbiArg(Args, "n32")) + CmdArgs.push_back("elf32btsmipn32_fbsd"); +else + CmdArgs.push_back("elf64btsmip_fbsd"); +break; + case llvm::Triple::mips64el: +CmdArgs.push_back("-m"); +if (tools::mips::hasMipsAbiArg(Args, "n32")) + CmdArgs.push_back("elf32ltsmipn32_fbsd"); +else + CmdArgs.push_back("elf64ltsmip_fbsd"); +break; } if (Arg *A = Args.getLastArg(options::OPT_G)) { Modified: cfe/trunk/test/Driver/freebsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd.c?rev=335691=335690=335691=diff == --- cfe/trunk/test/Driver/freebsd.c (original) +++ cfe/trunk/test/Driver/freebsd.c Tue Jun 26 17:02:16 2018 @@ -42,6 +42,27 @@ // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -print-search-dirs 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-LIB32PATHS %s // +// Check that MIPS passes the correct linker emulation. +// +// RUN: %clang -target mips-freebsd %s -### %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS-LD %s +// CHECK-MIPS-LD: ld{{.*}}" {{.*}} "-m" "elf32btsmip_fbsd" +// RUN: %clang -target mipsel-freebsd %s -### %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPSEL-LD %s +// CHECK-MIPSEL-LD: ld{{.*}}" {{.*}} "-m" "elf32ltsmip_fbsd" +// RUN: %clang -target mips64-freebsd %s -### %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS64-LD %s +// CHECK-MIPS64-LD: ld{{.*}}" {{.*}} "-m" "elf64btsmip_fbsd" +// RUN: %clang -target mips64el-freebsd %s -### %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-LD %s +// CHECK-MIPS64EL-LD: ld{{.*}}" {{.*}} "-m" "elf64ltsmip_fbsd" +// RUN: %clang -target mips64-freebsd -mabi=n32 %s -### %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPSN32-LD %s +// CHECK-MIPSN32-LD: ld{{.*}}" {{.*}} "-m" "elf32btsmipn32_fbsd" +// RUN: %clang -target mips64el-freebsd -mabi=n32 %s -### %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPSN32EL-LD %s +// CHECK-MIPSN32EL-LD: ld{{.*}}" {{.*}} "-m" "elf32ltsmipn32_fbsd" +// // Check that the new linker flags are passed to FreeBSD // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -m32 %s \ // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r335653 - [mips] Use more conservative default CPUs for MIPS on FreeBSD.
Author: jhb Date: Tue Jun 26 12:48:05 2018 New Revision: 335653 URL: http://llvm.org/viewvc/llvm-project?rev=335653=rev Log: [mips] Use more conservative default CPUs for MIPS on FreeBSD. FreeBSD defaults to mips3 for all MIPS ABIs with GCC as that is the minimum MIPS architecture FreeBSD supports. Use mips3 for MIPS64 and mips2 for MIPS32 to match. Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D48499 Modified: cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp cfe/trunk/test/Driver/freebsd-mips-as.c cfe/trunk/test/Driver/freebsd.c Modified: cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp?rev=335653=335652=335653=diff == --- cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Arch/Mips.cpp Tue Jun 26 12:48:05 2018 @@ -45,6 +45,13 @@ void mips::getMipsCPUAndABI(const ArgLis if (Triple.getOS() == llvm::Triple::OpenBSD) DefMips64CPU = "mips3"; + // MIPS2 is the default for mips(el)?-unknown-freebsd. + // MIPS3 is the default for mips64(el)?-unknown-freebsd. + if (Triple.getOS() == llvm::Triple::FreeBSD) { +DefMips32CPU = "mips2"; +DefMips64CPU = "mips3"; + } + if (Arg *A = Args.getLastArg(clang::driver::options::OPT_march_EQ, options::OPT_mcpu_EQ)) CPUName = A->getValue(); Modified: cfe/trunk/test/Driver/freebsd-mips-as.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd-mips-as.c?rev=335653=335652=335653=diff == --- cfe/trunk/test/Driver/freebsd-mips-as.c (original) +++ cfe/trunk/test/Driver/freebsd-mips-as.c Tue Jun 26 12:48:05 2018 @@ -3,62 +3,62 @@ // RUN: %clang -target mips-unknown-freebsd -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-AS %s -// MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB" +// MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-AS-NOT: "-KPIC" // // RUN: %clang -target mips-unknown-freebsd -### \ // RUN: -no-integrated-as -fPIC -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-PIC %s -// MIPS32-EB-PIC: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB" +// MIPS32-EB-PIC: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-PIC: "-KPIC" // // RUN: %clang -target mips-unknown-freebsd -### \ // RUN: -no-integrated-as -fpic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-PIC-SMALL %s -// MIPS32-EB-PIC-SMALL: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB" +// MIPS32-EB-PIC-SMALL: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-PIC-SMALL: "-KPIC" // // RUN: %clang -target mips-unknown-freebsd -### \ // RUN: -no-integrated-as -fPIE -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-PIE %s -// MIPS32-EB-PIE: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB" +// MIPS32-EB-PIE: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-PIE: "-KPIC" // // RUN: %clang -target mips-unknown-freebsd -### \ // RUN: -no-integrated-as -fpie -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-PIE-SMALL %s -// MIPS32-EB-PIE-SMALL: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB" +// MIPS32-EB-PIE-SMALL: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-PIE-SMALL: "-KPIC" // // RUN: %clang -target mipsel-unknown-freebsd -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-DEF-EL-AS %s -// MIPS32-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EL" +// MIPS32-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EL" // // RUN: %clang -target mips64-unknown-freebsd -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64-EB-AS %s -// MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EB" +// MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips3" "-mabi" "64" "-EB" // // RUN: %clang -target mips64el-unknown-freebsd -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s -// MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL" +// MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips3" "-mabi" "64" "-EL" // // RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s -// MIPS-N32: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "n32" "-EB" +// MIPS-N32: as{{(.exe)?}}" "-march" "mips3" "-mabi" "n32" "-EB" // // RUN: %clang -target mipsel-unknown-freebsd -mabi=32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EL-AS %s -// MIPS32-EL-AS: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EL" +//
[libunwind] r332414 - [libunwind][MIPS] Support MIPS floating-point registers for hard-float ABIs.
Author: jhb Date: Tue May 15 15:44:56 2018 New Revision: 332414 URL: http://llvm.org/viewvc/llvm-project?rev=332414=rev Log: [libunwind][MIPS] Support MIPS floating-point registers for hard-float ABIs. Summary: For MIPS ABIs with 64-bit floating point registers including newabi and O32 with 64-bit floating point registers, just save and restore the 32 floating-point registers as doubles. For O32 MIPS with 32-bit floating-point registers, save and restore the individual floating-point registers as "plain" registers. These registers are encoded as floats rather than doubles, but the DWARF unwinder assumes that floating-point registers are stored as doubles when reading them from memory (via AddressSpace::getDouble()). Treating the registers as "normal" registers instead causes the DWARF unwinder to fetch them from memory as a 32-bit register. This does mean that for O32 with 32-bit floating-point registers unw_get_fpreg() and unw_set_fpreg() do not work. One would have to use unw_get_reg() and unw_set_reg() instead. However, DWARF unwinding works correctly as the DWARF CFI emits records for individual 32-bit floating-point registers even when they are treated as doubles stored in paired registers. If the lack of unw_get/set_fpreg() becomes a pressing need in the future for O32 MIPS we could add in special handling to make it work. Reviewers: sdardis, compnerd Reviewed By: sdardis Differential Revision: https://reviews.llvm.org/D41968 Modified: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/include/libunwind.h libunwind/trunk/src/Registers.hpp libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S libunwind/trunk/src/libunwind.cpp Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=332414=332413=332414=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Tue May 15 15:44:56 2018 @@ -71,18 +71,33 @@ # define _LIBUNWIND_CURSOR_SIZE 24 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K # elif defined(__mips__) -# if defined(_ABIO32) && _MIPS_SIM == _ABIO32 && defined(__mips_soft_float) +# if defined(_ABIO32) && _MIPS_SIM == _ABIO32 #define _LIBUNWIND_TARGET_MIPS_O32 1 -#define _LIBUNWIND_CONTEXT_SIZE 18 -#define _LIBUNWIND_CURSOR_SIZE 24 -# elif defined(_ABIN32) && _MIPS_SIM == _ABIN32 && defined(__mips_soft_float) +#if defined(__mips_hard_float) +# define _LIBUNWIND_CONTEXT_SIZE 50 +# define _LIBUNWIND_CURSOR_SIZE 57 +#else +# define _LIBUNWIND_CONTEXT_SIZE 18 +# define _LIBUNWIND_CURSOR_SIZE 24 +#endif +# elif defined(_ABIN32) && _MIPS_SIM == _ABIN32 #define _LIBUNWIND_TARGET_MIPS_NEWABI 1 -#define _LIBUNWIND_CONTEXT_SIZE 35 -#define _LIBUNWIND_CURSOR_SIZE 42 -# elif defined(_ABI64) && _MIPS_SIM == _ABI64 && defined(__mips_soft_float) +#if defined(__mips_hard_float) +# define _LIBUNWIND_CONTEXT_SIZE 67 +# define _LIBUNWIND_CURSOR_SIZE 74 +#else +# define _LIBUNWIND_CONTEXT_SIZE 35 +# define _LIBUNWIND_CURSOR_SIZE 42 +#endif +# elif defined(_ABI64) && _MIPS_SIM == _ABI64 #define _LIBUNWIND_TARGET_MIPS_NEWABI 1 -#define _LIBUNWIND_CONTEXT_SIZE 35 -#define _LIBUNWIND_CURSOR_SIZE 47 +#if defined(__mips_hard_float) +# define _LIBUNWIND_CONTEXT_SIZE 67 +# define _LIBUNWIND_CURSOR_SIZE 79 +#else +# define _LIBUNWIND_CONTEXT_SIZE 35 +# define _LIBUNWIND_CURSOR_SIZE 47 +#endif # else #error "Unsupported MIPS ABI and/or environment" # endif Modified: libunwind/trunk/include/libunwind.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=332414=332413=332414=diff == --- libunwind/trunk/include/libunwind.h (original) +++ libunwind/trunk/include/libunwind.h Tue May 15 15:44:56 2018 @@ -781,6 +781,38 @@ enum { UNW_MIPS_R29 = 29, UNW_MIPS_R30 = 30, UNW_MIPS_R31 = 31, + UNW_MIPS_F0 = 32, + UNW_MIPS_F1 = 33, + UNW_MIPS_F2 = 34, + UNW_MIPS_F3 = 35, + UNW_MIPS_F4 = 36, + UNW_MIPS_F5 = 37, + UNW_MIPS_F6 = 38, + UNW_MIPS_F7 = 39, + UNW_MIPS_F8 = 40, + UNW_MIPS_F9 = 41, + UNW_MIPS_F10 = 42, + UNW_MIPS_F11 = 43, + UNW_MIPS_F12 = 44, + UNW_MIPS_F13 = 45, + UNW_MIPS_F14 = 46, + UNW_MIPS_F15 = 47, + UNW_MIPS_F16 = 48, + UNW_MIPS_F17 = 49, + UNW_MIPS_F18 = 50, + UNW_MIPS_F19 = 51, + UNW_MIPS_F20 = 52, + UNW_MIPS_F21 = 53, + UNW_MIPS_F22 = 54, + UNW_MIPS_F23 = 55, + UNW_MIPS_F24 = 56, + UNW_MIPS_F25 = 57, + UNW_MIPS_F26 = 58, + UNW_MIPS_F27 = 59, + UNW_MIPS_F28 = 60, + UNW_MIPS_F29 = 61, + UNW_MIPS_F30 = 62, + UNW_MIPS_F31 = 63, UNW_MIPS_HI = 64, UNW_MIPS_LO = 65, }; Modified:
[libunwind] r326250 - [libunwind][MIPS]: Add support for unwinding in N32 processes.
Author: jhb Date: Tue Feb 27 13:24:02 2018 New Revision: 326250 URL: http://llvm.org/viewvc/llvm-project?rev=326250=rev Log: [libunwind][MIPS]: Add support for unwinding in N32 processes. Summary: N32 uses the same register context as N64. However, N32 requires one change to properly fetch addresses from registers stored in memory. Since N32 is an ILP32 platform, getP() only fetches the first 32-bits of a stored register. For a big-endian platform this fetches the upper 32-bits which will be zero. To fix this, add a new getRegister() method to AddressSpace which is responsible for extracting the address stored in a register in memory. This matches getP() for all current ABIs except for N32 where it reads the 64-bit register and returns the low 32-bits as an address. The DwarfInstructions::getSavedRegister() method uses AddressSpace::getRegister() instead of AddressSpace::getP(). Reviewers: sdardis, compnerd Reviewed By: sdardis Differential Revision: https://reviews.llvm.org/D39074 Modified: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/src/AddressSpace.hpp libunwind/trunk/src/DwarfInstructions.hpp libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S libunwind/trunk/src/libunwind.cpp Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=326250=326249=326250=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Tue Feb 27 13:24:02 2018 @@ -71,11 +71,15 @@ # define _LIBUNWIND_CURSOR_SIZE 24 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K # elif defined(__mips__) -# if defined(_ABIO32) && defined(__mips_soft_float) +# if defined(_ABIO32) && _MIPS_SIM == _ABIO32 && defined(__mips_soft_float) #define _LIBUNWIND_TARGET_MIPS_O32 1 #define _LIBUNWIND_CONTEXT_SIZE 18 #define _LIBUNWIND_CURSOR_SIZE 24 -# elif defined(_ABI64) && defined(__mips_soft_float) +# elif defined(_ABIN32) && _MIPS_SIM == _ABIN32 && defined(__mips_soft_float) +#define _LIBUNWIND_TARGET_MIPS_NEWABI 1 +#define _LIBUNWIND_CONTEXT_SIZE 35 +#define _LIBUNWIND_CURSOR_SIZE 42 +# elif defined(_ABI64) && _MIPS_SIM == _ABI64 && defined(__mips_soft_float) #define _LIBUNWIND_TARGET_MIPS_NEWABI 1 #define _LIBUNWIND_CONTEXT_SIZE 35 #define _LIBUNWIND_CURSOR_SIZE 47 Modified: libunwind/trunk/src/AddressSpace.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=326250=326249=326250=diff == --- libunwind/trunk/src/AddressSpace.hpp (original) +++ libunwind/trunk/src/AddressSpace.hpp Tue Feb 27 13:24:02 2018 @@ -207,6 +207,7 @@ public: return val; } uintptr_t getP(pint_t addr); + uint64_tgetRegister(pint_t addr); static uint64_t getULEB128(pint_t , pint_t end); static int64_t getSLEB128(pint_t , pint_t end); @@ -228,6 +229,14 @@ inline uintptr_t LocalAddressSpace::getP #endif } +inline uint64_t LocalAddressSpace::getRegister(pint_t addr) { +#if __SIZEOF_POINTER__ == 8 || defined(__mips64) + return get64(addr); +#else + return get32(addr); +#endif +} + /// Read a ULEB128 into a 64-bit word. inline uint64_t LocalAddressSpace::getULEB128(pint_t , pint_t end) { const uint8_t *p = (uint8_t *)addr; @@ -600,6 +609,7 @@ public: uint32_t get32(pint_t addr); uint64_t get64(pint_t addr); pint_tgetP(pint_t addr); + uint64_t getRegister(pint_t addr); uint64_t getULEB128(pint_t , pint_t end); int64_t getSLEB128(pint_t , pint_t end); pint_tgetEncodedP(pint_t , pint_t end, uint8_t encoding, @@ -636,7 +646,12 @@ typename P::uint_t RemoteAddressSpace } template -uint64_t RemoteAddressSpace::getULEB128(pint_t , pint_t end) { +typename P::uint_t OtherAddressSpace::getRegister(pint_t addr) { + return P::getRegister(*(uint64_t *)localCopy(addr)); +} + +template +uint64_t OtherAddressSpace::getULEB128(pint_t , pint_t end) { uintptr_t size = (end - addr); LocalAddressSpace::pint_t laddr = (LocalAddressSpace::pint_t) localCopy(addr); LocalAddressSpace::pint_t sladdr = laddr; Modified: libunwind/trunk/src/DwarfInstructions.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfInstructions.hpp?rev=326250=326249=326250=diff == --- libunwind/trunk/src/DwarfInstructions.hpp (original) +++ libunwind/trunk/src/DwarfInstructions.hpp Tue Feb 27 13:24:02 2018 @@ -82,10 +82,10 @@ typename A::pint_t DwarfInstructions
[libunwind] r326223 - [libunwind] Permit additional compiler and linker flags to be passed to tests.
Author: jhb Date: Tue Feb 27 10:40:04 2018 New Revision: 326223 URL: http://llvm.org/viewvc/llvm-project?rev=326223=rev Log: [libunwind] Permit additional compiler and linker flags to be passed to tests. Summary: This is done via new LIBUNWIND_TEST_COMPILER_FLAGS and LIBUNWIND_TEST_LINKER_FLAGS variables. Reviewed By: sdardis Differential Revision: https://reviews.llvm.org/D43585 Modified: libunwind/trunk/CMakeLists.txt libunwind/trunk/test/lit.site.cfg.in Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=326223=326222=326223=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Tue Feb 27 10:40:04 2018 @@ -139,6 +139,10 @@ option(LIBUNWIND_INSTALL_LIBRARY "Instal set(LIBUNWIND_TARGET_TRIPLE "" CACHE STRING "Target triple for cross compiling.") set(LIBUNWIND_GCC_TOOLCHAIN "" CACHE PATH "GCC toolchain for cross compiling.") set(LIBUNWIND_SYSROOT "" CACHE PATH "Sysroot for cross compiling.") +set(LIBUNWIND_TEST_LINKER_FLAGS "" CACHE STRING +"Additional linker flags for test programs.") +set(LIBUNWIND_TEST_COMPILER_FLAGS "" CACHE STRING +"Additional compiler flags for test programs.") if (NOT LIBUNWIND_ENABLE_SHARED AND NOT LIBUNWIND_ENABLE_STATIC) message(FATAL_ERROR "libunwind must be built as either a shared or static library.") Modified: libunwind/trunk/test/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/lit.site.cfg.in?rev=326223=326222=326223=diff == --- libunwind/trunk/test/lit.site.cfg.in (original) +++ libunwind/trunk/test/lit.site.cfg.in Tue Feb 27 10:40:04 2018 @@ -12,6 +12,8 @@ config.enable_threads = "@LIBU config.use_sanitizer= "@LLVM_USE_SANITIZER@" config.enable_32bit = "@LIBUNWIND_BUILD_32_BITS@" config.target_info = "@LIBUNWIND_TARGET_INFO@" +config.test_linker_flags= "@LIBUNWIND_TEST_LINKER_FLAGS@" +config.test_compiler_flags = "@LIBUNWIND_TEST_COMPILER_FLAGS@" config.executor = "@LIBUNWIND_EXECUTOR@" config.libunwind_shared = "@LIBUNWIND_ENABLE_SHARED@" config.enable_shared= "@LIBCXX_ENABLE_SHARED@" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r324948 - Look for 32-bit libraries in /usr/lib32 for MIPS O32 on FreeBSD.
Author: jhb Date: Mon Feb 12 14:22:01 2018 New Revision: 324948 URL: http://llvm.org/viewvc/llvm-project?rev=324948=rev Log: Look for 32-bit libraries in /usr/lib32 for MIPS O32 on FreeBSD. Summary: FreeBSD N64 MIPS systems can include 32-bit libraries for O32 in /usr/lib32 similar to the 32-bit compatibility libraries provided for FreeBSD/amd64 and FreeBSD/powerpc64. Reviewers: dim Reviewed By: dim Differential Revision: https://reviews.llvm.org/D42972 Modified: cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp cfe/trunk/test/Driver/freebsd.c Modified: cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp?rev=324948=324947=324948=diff == --- cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/FreeBSD.cpp Mon Feb 12 14:22:01 2018 @@ -317,6 +317,8 @@ FreeBSD::FreeBSD(const Driver , const // When targeting 32-bit platforms, look for '/usr/lib32/crt1.o' and fall // back to '/usr/lib' if it doesn't exist. if ((Triple.getArch() == llvm::Triple::x86 || + Triple.getArch() == llvm::Triple::mips || + Triple.getArch() == llvm::Triple::mipsel || Triple.getArch() == llvm::Triple::ppc) && D.getVFS().exists(getDriver().SysRoot + "/usr/lib32/crt1.o")) getFilePaths().push_back(getDriver().SysRoot + "/usr/lib32"); Modified: cfe/trunk/test/Driver/freebsd.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/freebsd.c?rev=324948=324947=324948=diff == --- cfe/trunk/test/Driver/freebsd.c (original) +++ cfe/trunk/test/Driver/freebsd.c Mon Feb 12 14:22:01 2018 @@ -36,6 +36,12 @@ // RUN: | FileCheck --check-prefix=CHECK-LIB32PATHS %s // CHECK-LIB32PATHS: libraries: ={{.*:?}}/usr/lib32 // +// Check that O32 MIPS uses /usr/lib32 on a 64-bit tree. +// +// RUN: %clang -target mips-freebsd12 %s \ +// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -print-search-dirs 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-LIB32PATHS %s +// // Check that the new linker flags are passed to FreeBSD // RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -m32 %s \ // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r322093 - [libunwind][MIPS]: Rename Registers_mips_n64 to Registers_mips_newabi.
Author: jhb Date: Tue Jan 9 09:07:18 2018 New Revision: 322093 URL: http://llvm.org/viewvc/llvm-project?rev=322093=rev Log: [libunwind][MIPS]: Rename Registers_mips_n64 to Registers_mips_newabi. This is in preparation for adding support for N32 unwinding which reuses the newabi register class. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D41842 Modified: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/src/Registers.hpp libunwind/trunk/src/UnwindCursor.hpp libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/libunwind.cpp Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=322093=322092=322093=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Tue Jan 9 09:07:18 2018 @@ -76,7 +76,7 @@ #define _LIBUNWIND_CONTEXT_SIZE 18 #define _LIBUNWIND_CURSOR_SIZE 24 # elif defined(_ABI64) && defined(__mips_soft_float) -#define _LIBUNWIND_TARGET_MIPS_N64 1 +#define _LIBUNWIND_TARGET_MIPS_NEWABI 1 #define _LIBUNWIND_CONTEXT_SIZE 35 #define _LIBUNWIND_CURSOR_SIZE 47 # else @@ -95,7 +95,7 @@ # define _LIBUNWIND_TARGET_ARM 1 # define _LIBUNWIND_TARGET_OR1K 1 # define _LIBUNWIND_TARGET_MIPS_O32 1 -# define _LIBUNWIND_TARGET_MIPS_N64 1 +# define _LIBUNWIND_TARGET_MIPS_NEWABI 1 # define _LIBUNWIND_CONTEXT_SIZE 136 # define _LIBUNWIND_CURSOR_SIZE 148 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287 Modified: libunwind/trunk/src/Registers.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Registers.hpp?rev=322093=322092=322093=diff == --- libunwind/trunk/src/Registers.hpp (original) +++ libunwind/trunk/src/Registers.hpp Tue Jan 9 09:07:18 2018 @@ -2825,13 +2825,13 @@ inline const char *Registers_mips_o32::g } #endif // _LIBUNWIND_TARGET_MIPS_O32 -#if defined(_LIBUNWIND_TARGET_MIPS_N64) -/// Registers_mips_n64 holds the register state of a thread in a 64-bit MIPS -/// process. -class _LIBUNWIND_HIDDEN Registers_mips_n64 { +#if defined(_LIBUNWIND_TARGET_MIPS_NEWABI) +/// Registers_mips_newabi holds the register state of a thread in a +/// MIPS process using NEWABI (the N32 or N64 ABIs). +class _LIBUNWIND_HIDDEN Registers_mips_newabi { public: - Registers_mips_n64(); - Registers_mips_n64(const void *registers); + Registers_mips_newabi(); + Registers_mips_newabi(const void *registers); boolvalidRegister(int num) const; uint64_tgetRegister(int num) const; @@ -2852,28 +2852,28 @@ public: void setIP(uint64_t value) { _registers.__pc = value; } private: - struct mips_n64_thread_state_t { + struct mips_newabi_thread_state_t { uint64_t __r[32]; uint64_t __pc; uint64_t __hi; uint64_t __lo; }; - mips_n64_thread_state_t _registers; + mips_newabi_thread_state_t _registers; }; -inline Registers_mips_n64::Registers_mips_n64(const void *registers) { - static_assert((check_fit::does_fit), -"mips_n64 registers do not fit into unw_context_t"); +inline Registers_mips_newabi::Registers_mips_newabi(const void *registers) { + static_assert((check_fit ::does_fit), +"mips_newabi registers do not fit into unw_context_t"); memcpy(&_registers, static_cast(registers), sizeof(_registers)); } -inline Registers_mips_n64::Registers_mips_n64() { +inline Registers_mips_newabi::Registers_mips_newabi() { memset(&_registers, 0, sizeof(_registers)); } -inline bool Registers_mips_n64::validRegister(int regNum) const { +inline bool Registers_mips_newabi::validRegister(int regNum) const { if (regNum == UNW_REG_IP) return true; if (regNum == UNW_REG_SP) @@ -2890,7 +2890,7 @@ inline bool Registers_mips_n64::validReg return false; } -inline uint64_t Registers_mips_n64::getRegister(int regNum) const { +inline uint64_t Registers_mips_newabi::getRegister(int regNum) const { if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) return _registers.__r[regNum - UNW_MIPS_R0]; @@ -2904,10 +2904,10 @@ inline uint64_t Registers_mips_n64::getR case UNW_MIPS_LO: return _registers.__lo; } - _LIBUNWIND_ABORT("unsupported mips_n64 register"); + _LIBUNWIND_ABORT("unsupported mips_newabi register"); } -inline void Registers_mips_n64::setRegister(int regNum, uint64_t value) { +inline void Registers_mips_newabi::setRegister(int regNum, uint64_t value) { if (regNum >= UNW_MIPS_R0 && regNum <= UNW_MIPS_R31) { _registers.__r[regNum - UNW_MIPS_R0] = value; return; @@ -2927,35 +2927,35 @@ inline void Registers_mips_n64::setRegis _registers.__lo = value; return; } - _LIBUNWIND_ABORT("unsupported
[libunwind] r320528 - [libunwind][MIPS]: Add support for unwinding in O32 and N64 processes.
Author: jhb Date: Tue Dec 12 13:43:36 2017 New Revision: 320528 URL: http://llvm.org/viewvc/llvm-project?rev=320528=rev Log: [libunwind][MIPS]: Add support for unwinding in O32 and N64 processes. This supports the soft-float ABI only and has been tested with both clang and gcc on FreeBSD. Reviewed By: sdardis, compnerd Differential Revision: https://reviews.llvm.org/D38110 Modified: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/include/libunwind.h libunwind/trunk/src/Registers.hpp libunwind/trunk/src/UnwindCursor.hpp libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S libunwind/trunk/src/config.h libunwind/trunk/src/libunwind.cpp Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=320528=320527=320528=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Tue Dec 12 13:43:36 2017 @@ -21,6 +21,7 @@ #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 95 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM 287 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K 31 +#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS 65 #if defined(_LIBUNWIND_IS_NATIVE_ONLY) # if defined(__i386__) @@ -63,6 +64,19 @@ # define _LIBUNWIND_CONTEXT_SIZE 16 # define _LIBUNWIND_CURSOR_SIZE 24 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K +# elif defined(__mips__) +# if defined(_ABIO32) && defined(__mips_soft_float) +#define _LIBUNWIND_TARGET_MIPS_O32 1 +#define _LIBUNWIND_CONTEXT_SIZE 18 +#define _LIBUNWIND_CURSOR_SIZE 24 +# elif defined(_ABI64) && defined(__mips_soft_float) +#define _LIBUNWIND_TARGET_MIPS_N64 1 +#define _LIBUNWIND_CONTEXT_SIZE 35 +#define _LIBUNWIND_CURSOR_SIZE 47 +# else +#error "Unsupported MIPS ABI and/or environment" +# endif +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS # else # error "Unsupported architecture." # endif @@ -73,6 +87,8 @@ # define _LIBUNWIND_TARGET_AARCH64 1 # define _LIBUNWIND_TARGET_ARM 1 # define _LIBUNWIND_TARGET_OR1K 1 +# define _LIBUNWIND_TARGET_MIPS_O32 1 +# define _LIBUNWIND_TARGET_MIPS_N64 1 # define _LIBUNWIND_CONTEXT_SIZE 128 # define _LIBUNWIND_CURSOR_SIZE 140 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287 Modified: libunwind/trunk/include/libunwind.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=320528=320527=320528=diff == --- libunwind/trunk/include/libunwind.h (original) +++ libunwind/trunk/include/libunwind.h Tue Dec 12 13:43:36 2017 @@ -563,4 +563,42 @@ enum { UNW_OR1K_R31 = 31, }; +// MIPS registers +enum { + UNW_MIPS_R0 = 0, + UNW_MIPS_R1 = 1, + UNW_MIPS_R2 = 2, + UNW_MIPS_R3 = 3, + UNW_MIPS_R4 = 4, + UNW_MIPS_R5 = 5, + UNW_MIPS_R6 = 6, + UNW_MIPS_R7 = 7, + UNW_MIPS_R8 = 8, + UNW_MIPS_R9 = 9, + UNW_MIPS_R10 = 10, + UNW_MIPS_R11 = 11, + UNW_MIPS_R12 = 12, + UNW_MIPS_R13 = 13, + UNW_MIPS_R14 = 14, + UNW_MIPS_R15 = 15, + UNW_MIPS_R16 = 16, + UNW_MIPS_R17 = 17, + UNW_MIPS_R18 = 18, + UNW_MIPS_R19 = 19, + UNW_MIPS_R20 = 20, + UNW_MIPS_R21 = 21, + UNW_MIPS_R22 = 22, + UNW_MIPS_R23 = 23, + UNW_MIPS_R24 = 24, + UNW_MIPS_R25 = 25, + UNW_MIPS_R26 = 26, + UNW_MIPS_R27 = 27, + UNW_MIPS_R28 = 28, + UNW_MIPS_R29 = 29, + UNW_MIPS_R30 = 30, + UNW_MIPS_R31 = 31, + UNW_MIPS_HI = 64, + UNW_MIPS_LO = 65, +}; + #endif Modified: libunwind/trunk/src/Registers.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Registers.hpp?rev=320528=320527=320528=diff == --- libunwind/trunk/src/Registers.hpp (original) +++ libunwind/trunk/src/Registers.hpp Tue Dec 12 13:43:36 2017 @@ -2041,6 +2041,418 @@ inline const char *Registers_or1k::getRe } #endif // _LIBUNWIND_TARGET_OR1K + +#if defined(_LIBUNWIND_TARGET_MIPS_O32) +/// Registers_mips_o32 holds the register state of a thread in a 32-bit MIPS +/// process. +class _LIBUNWIND_HIDDEN Registers_mips_o32 { +public: + Registers_mips_o32(); + Registers_mips_o32(const void *registers); + + boolvalidRegister(int num) const; + uint32_tgetRegister(int num) const; + voidsetRegister(int num, uint32_t value); + boolvalidFloatRegister(int num) const; + double getFloatRegister(int num) const; + voidsetFloatRegister(int num, double value); + boolvalidVectorRegister(int num) const; + v128getVectorRegister(int num) const; + voidsetVectorRegister(int num, v128 value); + const char *getRegisterName(int num); + voidjumpto(); + static int lastDwarfRegNum() { return
Re: [libunwind] r316745 - Express Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTER
On 10/27/17 8:59 AM, Martin Storsjo via cfe-commits wrote: > Author: mstorsjo > Date: Fri Oct 27 00:59:01 2017 > New Revision: 316745 > > URL: http://llvm.org/viewvc/llvm-project?rev=316745=rev > Log: > Express Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTER > > This avoids having to keep the same information duplicated in multiple > places. > > Adjust _LIBUNWIND_HIGHEST_DWARF_REGISTER to actually have the value > of the highest used register and only use the value > _LIBUNWIND_HIGHEST_DWARF_REGISTER + 1 (kMaxRegisterNumber + 1) for > allocating the savedRegisters array. Sorry I didn't realize it during the review, but I've just realized why using HIGHEST_DWARF_REGISTER is not correct in the various Register classes. If you are building without _LIBUNWIND_IS_NATIVE_ONLY defined, then you will end up with all of the Register classes returning the same value (119 from the end of __libunwind_config.h) instead of the architecture-specific value. This is a change in behavior, so the Registers.hpp portion of this change should perhaps be reverted. > Differential Revision: https://reviews.llvm.org/D39281 > > Modified: > libunwind/trunk/include/__libunwind_config.h > libunwind/trunk/src/DwarfInstructions.hpp > libunwind/trunk/src/DwarfParser.hpp > libunwind/trunk/src/Registers.hpp > > Modified: libunwind/trunk/include/__libunwind_config.h > URL: > http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=316745=316744=316745=diff > == > --- libunwind/trunk/include/__libunwind_config.h (original) > +++ libunwind/trunk/include/__libunwind_config.h Fri Oct 27 00:59:01 2017 > @@ -20,22 +20,22 @@ > # define _LIBUNWIND_TARGET_I386 > # define _LIBUNWIND_CONTEXT_SIZE 8 > # define _LIBUNWIND_CURSOR_SIZE 19 > -# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 9 > +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 8 > # elif defined(__x86_64__) > # define _LIBUNWIND_TARGET_X86_64 1 > # define _LIBUNWIND_CONTEXT_SIZE 21 > # define _LIBUNWIND_CURSOR_SIZE 33 > -# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 17 > +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 16 > # elif defined(__ppc__) > # define _LIBUNWIND_TARGET_PPC 1 > # define _LIBUNWIND_CONTEXT_SIZE 117 > # define _LIBUNWIND_CURSOR_SIZE 128 > -# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 113 > +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 112 > # elif defined(__aarch64__) > # define _LIBUNWIND_TARGET_AARCH64 1 > # define _LIBUNWIND_CONTEXT_SIZE 66 > # define _LIBUNWIND_CURSOR_SIZE 78 > -# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 96 > +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 95 > # elif defined(__arm__) > # define _LIBUNWIND_TARGET_ARM 1 > # if defined(__ARM_WMMX) > @@ -45,12 +45,12 @@ > #define _LIBUNWIND_CONTEXT_SIZE 42 > #define _LIBUNWIND_CURSOR_SIZE 49 > # endif > -# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 96 > +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 95 > # elif defined(__or1k__) > # define _LIBUNWIND_TARGET_OR1K 1 > # define _LIBUNWIND_CONTEXT_SIZE 16 > # define _LIBUNWIND_CURSOR_SIZE 28 > -# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 32 > +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 31 > # else > # error "Unsupported architecture." > # endif > @@ -63,7 +63,7 @@ > # define _LIBUNWIND_TARGET_OR1K 1 > # define _LIBUNWIND_CONTEXT_SIZE 128 > # define _LIBUNWIND_CURSOR_SIZE 140 > -# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 120 > +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 119 > #endif // _LIBUNWIND_IS_NATIVE_ONLY > > #endif // LIBUNWIND_CONFIG_H__ > > Modified: libunwind/trunk/src/DwarfInstructions.hpp > URL: > http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfInstructions.hpp?rev=316745=316744=316745=diff > == > --- libunwind/trunk/src/DwarfInstructions.hpp (original) > +++ libunwind/trunk/src/DwarfInstructions.hpp Fri Oct 27 00:59:01 2017 > @@ -167,7 +167,7 @@ int DwarfInstructions::stepWithDwa >R newRegisters = registers; >pint_t returnAddress = 0; >const int lastReg = R::lastDwarfRegNum(); > - assert((int)CFI_Parser::kMaxRegisterNumber > lastReg && > + assert(static_cast(CFI_Parser::kMaxRegisterNumber) >= lastReg > && > "register range too large"); >assert(lastReg >= (int)cieInfo.returnAddressRegister && > "register range does not contain return address register"); > > Modified: libunwind/trunk/src/DwarfParser.hpp > URL: > http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfParser.hpp?rev=316745=316744=316745=diff > == > --- libunwind/trunk/src/DwarfParser.hpp (original) > +++ libunwind/trunk/src/DwarfParser.hpp Fri Oct 27 00:59:01 2017 > @@ -87,7 +87,7 @@ public: > uint32_t codeOffsetAtStackDecrement; >
[libunwind] r313920 - [libunwind] Partially revert r297174 to fix build on at least FreeBSD.
Author: jhb Date: Thu Sep 21 14:28:48 2017 New Revision: 313920 URL: http://llvm.org/viewvc/llvm-project?rev=313920=rev Log: [libunwind] Partially revert r297174 to fix build on at least FreeBSD. The changes in r297174 moved the #include of on FreeBSD (and probably other systems) inside of the open 'libunwind' namespace causing various system-provided types such as pid_t to be declared in this namespace rather than the global namespace. Fix this by moving the relevant declarations before the 'libunwind' namespace is opened, but still using the cleaned up declarations from r297174. Reviewed By: ed, compnerd Differential Revision: https://reviews.llvm.org/D38108 Modified: libunwind/trunk/src/AddressSpace.hpp Modified: libunwind/trunk/src/AddressSpace.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=313920=313919=313920=diff == --- libunwind/trunk/src/AddressSpace.hpp (original) +++ libunwind/trunk/src/AddressSpace.hpp Thu Sep 21 14:28:48 2017 @@ -35,6 +35,75 @@ namespace libunwind { #include "EHHeaderParser.hpp" #include "Registers.hpp" +#ifdef __APPLE__ + + struct dyld_unwind_sections + { +const struct mach_header* mh; +const void* dwarf_section; +uintptr_t dwarf_section_length; +const void* compact_unwind_section; +uintptr_t compact_unwind_section_length; + }; + #if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) \ + && (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) \ + || defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +// In 10.7.0 or later, libSystem.dylib implements this function. +extern "C" bool _dyld_find_unwind_sections(void *, dyld_unwind_sections *); + #else +// In 10.6.x and earlier, we need to implement this functionality. Note +// that this requires a newer version of libmacho (from cctools) than is +// present in libSystem on 10.6.x (for getsectiondata). +static inline bool _dyld_find_unwind_sections(void* addr, +dyld_unwind_sections* info) { + // Find mach-o image containing address. + Dl_info dlinfo; + if (!dladdr(addr, )) +return false; +#if __LP64__ + const struct mach_header_64 *mh = (const struct mach_header_64 *)dlinfo.dli_fbase; +#else + const struct mach_header *mh = (const struct mach_header *)dlinfo.dli_fbase; +#endif + + // Initialize the return struct + info->mh = (const struct mach_header *)mh; + info->dwarf_section = getsectiondata(mh, "__TEXT", "__eh_frame", >dwarf_section_length); + info->compact_unwind_section = getsectiondata(mh, "__TEXT", "__unwind_info", >compact_unwind_section_length); + + if (!info->dwarf_section) { +info->dwarf_section_length = 0; + } + + if (!info->compact_unwind_section) { +info->compact_unwind_section_length = 0; + } + + return true; +} + #endif + +#elif defined(_LIBUNWIND_ARM_EHABI) && defined(_LIBUNWIND_IS_BAREMETAL) + +// When statically linked on bare-metal, the symbols for the EH table are looked +// up without going through the dynamic loader. +extern char __exidx_start; +extern char __exidx_end; + +#elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) + +// ELF-based systems may use dl_iterate_phdr() to access sections +// containing unwinding information. The ElfW() macro for pointer-size +// independent ELF header traversal is not provided by on some +// systems (e.g., FreeBSD). On these systems the data structures are +// just called Elf_XXX. Define ElfW() locally. +#include +#if !defined(ElfW) +#define ElfW(type) Elf_##type +#endif + +#endif + namespace libunwind { /// Used by findUnwindSections() to return info about needed sections. @@ -265,75 +334,6 @@ LocalAddressSpace::getEncodedP(pint_t return result; } -#ifdef __APPLE__ - - struct dyld_unwind_sections - { -const struct mach_header* mh; -const void* dwarf_section; -uintptr_t dwarf_section_length; -const void* compact_unwind_section; -uintptr_t compact_unwind_section_length; - }; - #if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) \ - && (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) \ - || defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -// In 10.7.0 or later, libSystem.dylib implements this function. -extern "C" bool _dyld_find_unwind_sections(void *, dyld_unwind_sections *); - #else -// In 10.6.x and earlier, we need to implement this functionality. Note -// that this requires a newer version of libmacho (from cctools) than is -// present in libSystem on 10.6.x (for getsectiondata). -static inline bool _dyld_find_unwind_sections(void* addr, -