@@ -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 =
@@ -357,6 +363,7 @@ ifneq "$(OS)" "Darwin"
357
363
358
364
OBJCOPY ?= $(call replace_cc_with,objcopy)
359
365
ARCHIVER ?= $(call replace_cc_with,ar)
366
+ DWP ?= $(call replace_cc_with,dwp)
360
367
override AR = $(ARCHIVER)
361
368
endif
362
369
@@ -527,6 +534,10 @@ ifneq "$(CXX)" ""
527
534
endif
528
535
endif
529
536
537
+ ifeq "$(GEN_GNU_BUILD_ID)" "YES"
538
+ LDFLAGS += -Wl,--build-id
539
+ endif
540
+
530
541
#----------------------------------------------------------------------
531
542
# DYLIB_ONLY variable can be used to skip the building of a.out.
532
543
# See the sections below regarding dSYM file as well as the building of
@@ -565,11 +576,25 @@ else
565
576
endif
566
577
else
567
578
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
579
+ ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
580
+ cp "$(EXE)" "$(EXE).unstriped""
581
+ endif
568
582
$(OBJCOPY) --only-keep-debug "$(EXE)" "$(DSYM)"
569
583
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DSYM)" "$(EXE)" "$(EXE)"
570
584
endif
585
+ ifeq "$(MAKE_DWP)" "YES"
586
+ $(DWP) -o "$(DWP_NAME)" $(DWOS)
587
+ endif
571
588
endif
572
589
590
+
591
+ #----------------------------------------------------------------------
592
+ # Support emitting the content of the GNU build-id into a file
593
+ # This needs to be used in conjunction with GEN_GNU_BUILD_ID := YES
594
+ #----------------------------------------------------------------------
595
+ $(EXE).uuid : $(EXE)
596
+ $(OBJCOPY) --dump-section=.note.gnu.build-id=$@ $<
597
+
573
598
#----------------------------------------------------------------------
574
599
# Make the dylib
575
600
#----------------------------------------------------------------------
@@ -610,9 +635,15 @@ endif
610
635
else
611
636
$(LD) $(DYLIB_OBJECTS) $(LDFLAGS) -shared -o "$(DYLIB_FILENAME)"
612
637
ifeq "$(SPLIT_DEBUG_SYMBOLS)" "YES"
638
+ ifeq "$(SAVE_FULL_DEBUG_BINARY)" "YES"
639
+ cp "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).unstripped"
640
+ endif
613
641
$(OBJCOPY) --only-keep-debug "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME).debug"
614
642
$(OBJCOPY) --strip-debug --add-gnu-debuglink="$(DYLIB_FILENAME).debug" "$(DYLIB_FILENAME)" "$(DYLIB_FILENAME)"
615
643
endif
644
+ ifeq "$(MAKE_DWP)" "YES"
645
+ $(DWP) -o $(DYLIB_DWP_FILE) $(DYLIB_DWOS)
646
+ endif
616
647
endif
617
648
618
649
#----------------------------------------------------------------------
0 commit comments