If you have these files
header1.h
int add1(int a) { return a + 1; }header2.h
int return4() { return 4; }test.c
#include "header1.h" #include "header2.h"
and compile them with clang -g -c test.c -o test.o and run llvm-objdump --source test.o, the source from header2.h is missing
0000000000000000 add1:
; int add1(int a) { return a + 1; }
0: 55 pushq %rbp
1: 48 89 e5 movq %rsp, %rbp
4: 89 7d fc movl %edi, -4(%rbp)
7: 8b 45 fc movl -4(%rbp), %eax
a: 83 c0 01 addl $1, %eax
d: 5d popq %rbp
e: c3 retq
f: 90 nop
0000000000000010 return4:
10: 55 pushq %rbp
11: 48 89 e5 movq %rsp, %rbp
14: b8 04 00 00 00 movl $4, %eax
19: 5d popq %rbp
1a: c3 retqThis patch fixes this problem, interleaving the source from header2.h
0000000000000000 add1:
; int add1(int a) { return a + 1; }
0: 55 pushq %rbp
1: 48 89 e5 movq %rsp, %rbp
4: 89 7d fc movl %edi, -4(%rbp)
7: 8b 45 fc movl -4(%rbp), %eax
a: 83 c0 01 addl $1, %eax
d: 5d popq %rbp
e: c3 retq
f: 90 nop
0000000000000010 return4:
; int return4() { return 4; }
10: 55 pushq %rbp
11: 48 89 e5 movq %rsp, %rbp
14: b8 04 00 00 00 movl $4, %eax
19: 5d popq %rbp
1a: c3 retqFYI I noticed this bug while working on a different patch requested by @jhenderson (https://bugs.llvm.org/show_bug.cgi?id=41905).