@@ -51,7 +51,7 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
51
51
#
52
52
# GNUWin32 uname gives "windows32" or "server version windows32" while
53
53
# some versions of MSYS uname return "MSYS_NT*", but most environments
54
- # standardize on "Windows_NT", so we'll make it consistent here.
54
+ # standardize on "Windows_NT", so we'll make it consistent here.
55
55
# When running tests from Visual Studio, the environment variable isn't
56
56
# inherited all the way down to the process spawned for make.
57
57
#----------------------------------------------------------------------
@@ -210,6 +210,12 @@ else
210
210
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
211
211
DSYM = $(EXE).debug
212
212
endif
213
+
214
+ ifeq "$(MAKE_DWP)" "YES"
215
+ MAKE_DWO := YES
216
+ DWP_NAME = $(EXE).dwp
217
+ DYLIB_DWP_NAME = $(DYLIB_NAME).dwp
218
+ endif
213
219
endif
214
220
215
221
LIMIT_DEBUG_INFO_FLAGS =
@@ -358,6 +364,7 @@ ifneq "$(OS)" "Darwin"
358
364
359
365
OBJCOPY ?= $(call replace_cc_with,objcopy)
360
366
ARCHIVER ?= $(call replace_cc_with,ar)
367
+ DWP ?= $(call replace_cc_with,dwp)
361
368
override AR = $(ARCHIVER)
362
369
endif
363
370
@@ -528,6 +535,10 @@ ifneq "$(CXX)" ""
528
535
endif
529
536
endif
530
537
538
+ ifeq "$(GEN_GNU_BUILD_ID)" "YES"
539
+ LDFLAGS += -Wl,--build-id
540
+ endif
541
+
531
542
#----------------------------------------------------------------------
532
543
# DYLIB_ONLY variable can be used to skip the building of a.out.
533
544
# See the sections below regarding dSYM file as well as the building of
@@ -566,11 +577,25 @@ else
566
577
endif
567
578
else
568
579
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
580
+ ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
581
+ cp "$(EXE)" "$(EXE).unstriped""
582
+ endif
569
583
$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
570
584
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
571
585
endif
586
+ ifeq "$(MAKE_DWP)" "YES"
587
+ $(DWP) -o "$(DWP_NAME)" $(DWOS)
588
+ endif
572
589
endif
573
590
591
+
592
+ #----------------------------------------------------------------------
593
+ # Support emitting the content of the GNU build-id into a file
594
+ # This needs to be used in conjunction with GEN_GNU_BUILD_ID := YES
595
+ #----------------------------------------------------------------------
596
+ $(EXE).uuid : $(EXE)
597
+ $(OBJCOPY) --dump-section=.note.gnu.build-id=$@ $<
598
+
574
599
#----------------------------------------------------------------------
575
600
# Make the dylib
576
601
#----------------------------------------------------------------------
@@ -611,9 +636,15 @@ endif
611
636
else
612
637
$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
613
638
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
639
+ ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
640
+ cp "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).unstripped"
641
+ endif
614
642
$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
615
643
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
616
644
endif
645
+ ifeq "$(MAKE_DWP)" "YES"
646
+ $(DWP) -o $(DYLIB_DWP_FILE) $(DYLIB_DWOS)
647
+ endif
617
648
endif
618
649
619
650
#----------------------------------------------------------------------
0 commit comments