[Lldb-commits] [lldb] fd0ab3b - [lldb] Pass -fPIC flag even when DYLIB_ONLY is set

2020-05-30 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-05-30T18:05:16+02:00
New Revision: fd0ab3b3eb88de3fe4792c34b50084595e22d68d

URL: 
https://github.com/llvm/llvm-project/commit/fd0ab3b3eb88de3fe4792c34b50084595e22d68d
DIFF: 
https://github.com/llvm/llvm-project/commit/fd0ab3b3eb88de3fe4792c34b50084595e22d68d.diff

LOG: [lldb] Pass -fPIC flag even when DYLIB_ONLY is set

Summary:
It seems that when we rewrite a few rules to only build a dylib (i.e., when 
DYLIB_ONLY is set),
the rule for setting the CFLAGS for the dylib's object file compilation will no 
longer work. From what I can
see this is because in DYLIB_ONLY mode we pretend to compile the main 
executable so
the DYLIB_OBJECTS scope is actually never used.

This patch makes `-fPIC` unstopped if DYLIB_ONLY is set so that -fPIC actually 
ends up in the
CFLAGS for the dylib object file compilation.

The test for this is D80798 which only compiles on Linux with this patch.

Reviewers: friss, labath

Reviewed By: friss

Subscribers: JDevlieghere

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

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/make/Makefile.rules

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index ea0fa748bc36..5e3f47884990 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -657,9 +657,14 @@ endif
 $(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL
 
 ifneq "$(OS)" "Windows_NT"
+ifeq "$(DYLIB_ONLY)" ""
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
+else
 $(DYLIB_OBJECTS) : CFLAGS += -fPIC
 $(DYLIB_OBJECTS) : CXXFLAGS += -fPIC
 endif
+endif
 
 $(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
 ifeq "$(OS)" "Darwin"



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D80789: [lldb] Pass -fPIC flag even when DYLIB_ONLY is set

2020-05-30 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
teemperor marked an inline comment as done.
Closed by commit rGfd0ab3b3eb88: [lldb] Pass -fPIC flag even when DYLIB_ONLY is 
set (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80789/new/

https://reviews.llvm.org/D80789

Files:
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules


Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -657,9 +657,14 @@
 $(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL
 
 ifneq "$(OS)" "Windows_NT"
+ifeq "$(DYLIB_ONLY)" ""
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
+else
 $(DYLIB_OBJECTS) : CFLAGS += -fPIC
 $(DYLIB_OBJECTS) : CXXFLAGS += -fPIC
 endif
+endif
 
 $(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
 ifeq "$(OS)" "Darwin"


Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -657,9 +657,14 @@
 $(DYLIB_OBJECTS) : CFLAGS += -DCOMPILING_LLDB_TEST_DLL
 
 ifneq "$(OS)" "Windows_NT"
+ifeq "$(DYLIB_ONLY)" ""
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
+else
 $(DYLIB_OBJECTS) : CFLAGS += -fPIC
 $(DYLIB_OBJECTS) : CXXFLAGS += -fPIC
 endif
+endif
 
 $(DYLIB_FILENAME) : $(DYLIB_OBJECTS)
 ifeq "$(OS)" "Darwin"
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D80755: Support build-ids of other sizes than 16 in UUID::SetFromStringRef

2020-05-30 Thread Jaroslav Sevcik via Phabricator via lldb-commits
jarin updated this revision to Diff 267490.
jarin marked an inline comment as done.
jarin added a comment.

Change SetFromStringRef to return bool.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80755/new/

https://reviews.llvm.org/D80755

Files:
  lldb/include/lldb/Utility/UUID.h
  lldb/source/Interpreter/OptionValueUUID.cpp
  lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
  lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Utility/UUID.cpp
  lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpUUID.py
  
lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-uuids-elf-build-id-4.yaml
  
lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-uuids-match.yaml
  lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
  lldb/unittests/Target/ModuleCacheTest.cpp
  lldb/unittests/Utility/UUIDTest.cpp

Index: lldb/unittests/Utility/UUIDTest.cpp
===
--- lldb/unittests/Utility/UUIDTest.cpp
+++ lldb/unittests/Utility/UUIDTest.cpp
@@ -45,7 +45,7 @@
   from_str.SetFromStringRef("----");
   UUID opt_from_str;
   opt_from_str.SetFromOptionalStringRef("----");
-  
+
   EXPECT_FALSE(empty);
   EXPECT_TRUE(a16);
   EXPECT_TRUE(a20);
@@ -57,25 +57,28 @@
 
 TEST(UUIDTest, SetFromStringRef) {
   UUID u;
-  EXPECT_EQ(32u, u.SetFromStringRef("404142434445464748494a4b4c4d4e4f"));
+  EXPECT_TRUE(u.SetFromStringRef("404142434445464748494a4b4c4d4e4f"));
   EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNO", 16), u);
 
-  EXPECT_EQ(36u, u.SetFromStringRef("40-41-42-43-4445464748494a4b4c4d4e4f"));
+  EXPECT_TRUE(u.SetFromStringRef("40-41-42-43-4445464748494a4b4c4d4e4f"));
   EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNO", 16), u);
 
-  EXPECT_EQ(45u, u.SetFromStringRef(
- "40-41-42-43-4445464748494a4b4c4d4e4f-50515253", 20));
+  EXPECT_TRUE(
+  u.SetFromStringRef("40-41-42-43-4445464748494a4b4c4d4e4f-50515253"));
   EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNOPQRS", 20), u);
 
-  EXPECT_EQ(0u, u.SetFromStringRef("40-41-42-43-4445464748494a4b4c4d4e4f", 20));
-  EXPECT_EQ(0u, u.SetFromStringRef("40x"));
-  EXPECT_EQ(0u, u.SetFromStringRef(""));
-  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNOPQRS", 20), u)
+  EXPECT_TRUE(u.SetFromStringRef("40-41-42-43-4445464748494a4b4c4d4e4f"));
+
+  EXPECT_FALSE(u.SetFromStringRef("40x"));
+  EXPECT_FALSE(u.SetFromStringRef(""));
+  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNO", 16), u)
   << "uuid was changed by failed parse calls";
 
-  EXPECT_EQ(
-  32u, u.SetFromStringRef("404142434445464748494a4b4c4d4e4f-50515253", 16));
-  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNO", 16), u);
+  EXPECT_TRUE(u.SetFromStringRef("404142434445464748494a4b4c4d4e4f-50515253"));
+  EXPECT_EQ(UUID::fromData("@ABCDEFGHIJKLMNOPQRS", 20), u);
+
+  EXPECT_TRUE(u.SetFromStringRef("40414243"));
+  EXPECT_EQ(UUID::fromData("@ABCD", 4), u);
 }
 
 TEST(UUIDTest, StringConverion) {
Index: lldb/unittests/Target/ModuleCacheTest.cpp
===
--- lldb/unittests/Target/ModuleCacheTest.cpp
+++ lldb/unittests/Target/ModuleCacheTest.cpp
@@ -41,7 +41,6 @@
 static const char module_name[] = "TestModule.so";
 static const char module_uuid[] =
 "F4E7E991-9B61-6AD4-0073-561AC3D9FA10-C043A476";
-static const uint32_t uuid_bytes = 20;
 static const size_t module_size = 5602;
 
 static FileSpec GetDummyRemotePath() {
@@ -87,7 +86,7 @@
   ModuleCache mc;
   ModuleSpec module_spec;
   module_spec.GetFileSpec() = GetDummyRemotePath();
-  module_spec.GetUUID().SetFromStringRef(module_uuid, uuid_bytes);
+  module_spec.GetUUID().SetFromStringRef(module_uuid);
   module_spec.SetObjectSize(module_size);
   ModuleSP module_sp;
   bool did_create;
Index: lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
===
--- lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
+++ lldb/unittests/ObjectFile/ELF/TestObjectFileELF.cpp
@@ -156,7 +156,7 @@
   ModuleSpec Spec;
   ASSERT_TRUE(Specs.GetModuleSpecAtIndex(0, Spec)) ;
   UUID Uuid;
-  Uuid.SetFromStringRef("1b8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9", 20);
+  Uuid.SetFromStringRef("1b8a73ac238390e32a7ff4ac8ebe4d6a41ecf5c9");
   EXPECT_EQ(Spec.GetUUID(), Uuid);
 }
 
@@ -284,4 +284,4 @@
 
   auto entry_point_addr = module_sp->GetObjectFile()->GetEntryPointAddress();
   ASSERT_EQ(entry_point_addr.GetAddressClass(), AddressClass::eCode);
-}
\ No newline at end of file
+}
Index: lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-uuids-match.yaml
===
--- /dev/null
+++ lldb/test/API/functionalities/postmortem/minidump-new/linux-arm-uuids-match.yaml
@@ -0,0 +1,15 @@
+--- !minidump
+Streams: 
+  - Type:S