Page MenuHomePhabricator

yonghong-song (Yonghong Song)
User

Projects

User does not belong to any projects.

User Details

User Since
Oct 4 2018, 11:50 PM (78 w, 5 d)

Recent Activity

Sat, Mar 28

yonghong-song committed rGced0d1f42b39: [BPF] support 128bit int explicitly in layout spec (authored by yonghong-song).
[BPF] support 128bit int explicitly in layout spec
Sat, Mar 28, 12:23 PM
yonghong-song closed D76587: [BPF] support 128bit int explicitly in layout spec.
Sat, Mar 28, 12:22 PM · Restricted Project

Sun, Mar 22

yonghong-song created D76587: [BPF] support 128bit int explicitly in layout spec.
Sun, Mar 22, 11:57 PM · Restricted Project

Feb 19 2020

yonghong-song updated the diff for D74572: [BPF] preserve debuginfo types for builtin __builtin__btf_type_id().

fix a typo (BPFPreserveType.cpp => BPFPreserveDIType.cpp) in the comments.

Feb 19 2020, 10:43 PM · Restricted Project, Restricted Project
yonghong-song updated the diff for D74572: [BPF] preserve debuginfo types for builtin __builtin__btf_type_id().

change llvm.bpf_pdit to llvm.btf_type_id variable name to make it easy to understand.

Feb 19 2020, 9:07 PM · Restricted Project, Restricted Project
yonghong-song added inline comments to D74572: [BPF] preserve debuginfo types for builtin __builtin__btf_type_id().
Feb 19 2020, 8:40 PM · Restricted Project, Restricted Project

Feb 15 2020

yonghong-song added a comment to D74572: [BPF] preserve debuginfo types for builtin __builtin__btf_type_id().

The corresponding clang side of change is https://reviews.llvm.org/D74668

Feb 15 2020, 8:42 AM · Restricted Project, Restricted Project
yonghong-song created D74668: [Clang][BPF] implement __builtin_btf_type_id() builtin function.
Feb 15 2020, 8:42 AM · Restricted Project, Restricted Project
yonghong-song added a comment to D74668: [Clang][BPF] implement __builtin_btf_type_id() builtin function.

The corresponding LLVM side of change is https://reviews.llvm.org/D74572

Feb 15 2020, 8:42 AM · Restricted Project, Restricted Project
yonghong-song updated the diff for D74572: [BPF] preserve debuginfo types for builtin __builtin__btf_type_id().

make this diff llvm BPF backend only. The clang side change will be posted separately.

Feb 15 2020, 8:40 AM · Restricted Project, Restricted Project

Feb 14 2020

yonghong-song updated the diff for D74572: [BPF] preserve debuginfo types for builtin __builtin__btf_type_id().

Addressing some Alexei's comments:

Change comments in clang CGBuiltin.cpp to make it easier to understand.
Remove BPFMIPreserveDIType.cpp and fold into existing BPFMISimplifyPatchable.cpp.
Other Simplifications.
Feb 14 2020, 10:48 AM · Restricted Project, Restricted Project

Feb 13 2020

yonghong-song updated the diff for D74572: [BPF] preserve debuginfo types for builtin __builtin__btf_type_id().

add the type_id assignment to FieldInfo relocation .btf.ext ELF section.

Feb 13 2020, 1:38 PM · Restricted Project, Restricted Project
yonghong-song created D74572: [BPF] preserve debuginfo types for builtin __builtin__btf_type_id().
Feb 13 2020, 11:10 AM · Restricted Project, Restricted Project

Feb 12 2020

yonghong-song committed rG61bd33e37b1d: [BPF] explicit warning of not supporting dynamic stack allocation (authored by yonghong-song).
[BPF] explicit warning of not supporting dynamic stack allocation
Feb 12 2020, 8:52 PM
yonghong-song closed D74521: [BPF] explicit warning of not supporting dynamic stack allocation.
Feb 12 2020, 8:52 PM · Restricted Project
yonghong-song created D74521: [BPF] explicit warning of not supporting dynamic stack allocation.
Feb 12 2020, 8:16 PM · Restricted Project

Feb 11 2020

yonghong-song committed rG29bc5dd19407: [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering (authored by yonghong-song).
[BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering
Feb 11 2020, 10:05 AM
yonghong-song closed D74101: [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering.
Feb 11 2020, 10:05 AM · Restricted Project
yonghong-song added a comment to D74101: [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering.

Please double check that all selftests/bpf still pass with and without alu32 before landing.

Feb 11 2020, 9:17 AM · Restricted Project

Feb 10 2020

yonghong-song added a comment to D74101: [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering.

arm64 uses this approach, but arm64 doesn't have 8-bit subregisters and it works ?

Feb 10 2020, 11:13 PM · Restricted Project
yonghong-song updated the diff for D74101: [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering.

make isTruncateFree more like AArch64 one. Remove !getHasAlu32() from isTruncateFree where it is not needed. But !getHasAlu32() is still needed in isZExtFree. Otherwise, we will get a llvm assertion like:

  CLNG-LLC [test_maps] test_xdp_noinline.o
llc: ../lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:978: void {anonymous}::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*): Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
Stack dump:
0.      Program arguments: llc -march=bpf -mcpu=v2 -filetype=obj -o /data/users/yhs/work/net-next/tools/testing/selftests/bpf/no_alu32/test_xdp_noinline.$
Feb 10 2020, 11:01 PM · Restricted Project
yonghong-song added a comment to D74101: [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering.

Note that I cannot do

In isTruncateFree() do
return NumBits1 > NumBits2;

This will permit a type truncate operation e.g., from 64bit to 8bit. This will cause a llvm internal assertion later since llvm expects
it produces a backend supported legal subregister type , which is 32bit in this case. PowerPC has similar implementation

bool PPCTargetLowering::isTruncateFree(Type *Ty1, Type *Ty2) const {
  if (!Ty1->isIntegerTy() || !Ty2->isIntegerTy())
    return false;
  unsigned NumBits1 = Ty1->getPrimitiveSizeInBits();
  unsigned NumBits2 = Ty2->getPrimitiveSizeInBits();
  return NumBits1 == 64 && NumBits2 == 32;
}
Feb 10 2020, 8:37 PM · Restricted Project
yonghong-song updated the diff for D74101: [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering.

add support isZExtFree as well

Feb 10 2020, 8:37 PM · Restricted Project

Feb 5 2020

yonghong-song added a comment to D73985: [bpf] zero extension is required in BPF implementaiton so remove <<=32 >>=32.

@jrfastab I added isTruncateFree() callback in BPF IR Lowering (isel) phase. See https://reviews.llvm.org/D74101. This should help with the case where packet data/data_end is truncated with 32bit MOV.

Feb 5 2020, 5:14 PM · Restricted Project
yonghong-song created D74101: [BPF] implement isTruncateFree and isZExtFree in BPFTargetLowering.
Feb 5 2020, 5:14 PM · Restricted Project

Feb 4 2020

yonghong-song committed rGd96c1bbaa035: [BPF] disable ReduceLoadWidth during SelectionDag phase (authored by yonghong-song).
[BPF] disable ReduceLoadWidth during SelectionDag phase
Feb 4 2020, 6:49 PM
yonghong-song closed D73997: [BPF] disable ReduceLoadWidth during SelectionDag phase.
Feb 4 2020, 6:49 PM · Restricted Project
yonghong-song created D73997: [BPF] disable ReduceLoadWidth during SelectionDag phase.
Feb 4 2020, 2:41 PM · Restricted Project
yonghong-song committed rG9271cab270a5: [BPF] use base lvalue type for preserve_{struct,union}_access_index metadata (authored by yonghong-song).
[BPF] use base lvalue type for preserve_{struct,union}_access_index metadata
Feb 4 2020, 9:35 AM
yonghong-song closed D73900: [BPF] use base lvalue type for preserve_{struct,union}_access_index metadata.
Feb 4 2020, 9:35 AM · Restricted Project
yonghong-song committed rG6d07802d63a8: [BPF] handle typedef of struct/union for CO-RE relocations (authored by yonghong-song).
[BPF] handle typedef of struct/union for CO-RE relocations
Feb 4 2020, 8:59 AM
yonghong-song closed D73902: [BPF] handle typedef of struct/union for CO-RE relocations.
Feb 4 2020, 8:58 AM · Restricted Project

Feb 3 2020

yonghong-song updated the diff for D73902: [BPF] handle typedef of struct/union for CO-RE relocations.

address Andrii's comments. Always use the typedef type name if it is available.

Feb 3 2020, 4:59 PM · Restricted Project
yonghong-song added inline comments to D73902: [BPF] handle typedef of struct/union for CO-RE relocations.
Feb 3 2020, 9:47 AM · Restricted Project
yonghong-song created D73902: [BPF] handle typedef of struct/union for CO-RE relocations.
Feb 3 2020, 8:59 AM · Restricted Project
yonghong-song created D73900: [BPF] use base lvalue type for preserve_{struct,union}_access_index metadata.
Feb 3 2020, 8:59 AM · Restricted Project

Jan 30 2020

yonghong-song committed rG795bbb366266: [BPF] fix a bug in BPFMISimplifyPatchable pass with -O0 (authored by yonghong-song).
[BPF] fix a bug in BPFMISimplifyPatchable pass with -O0
Jan 30 2020, 8:32 AM
yonghong-song closed D73681: [BPF] fix a bug in BPFMISimplifyPatchable pass with -O0.
Jan 30 2020, 8:32 AM · Restricted Project

Jan 29 2020

yonghong-song created D73681: [BPF] fix a bug in BPFMISimplifyPatchable pass with -O0.
Jan 29 2020, 11:22 PM · Restricted Project

Jan 21 2020

yonghong-song updated the diff for D72787: [BPF] Adjust optimizations to generate kernel verifier friendly codes.

revert back to previous version where no hacking with machine IR optimization to add extra "<<" and "s>>". Will try to enhance verifier to do the work.

Jan 21 2020, 8:47 AM · Restricted Project

Jan 17 2020

yonghong-song added a comment to D72787: [BPF] Adjust optimizations to generate kernel verifier friendly codes.

@tstellar Thanks for your comments. The MachineInstr SSA based optimization is really a ugly hack. Currently verifier is not able to verify the program correctly, i.e., rejects the program for certain patterns related subregister uses. The commit message provides more information. @ast suggested to look at whether we can improve kernel verifier and I will take a look there. If kernel can be enhanced, I will drop the second MachineInstr SSA pass.

Jan 17 2020, 8:39 PM · Restricted Project
yonghong-song added inline comments to D72787: [BPF] Adjust optimizations to generate kernel verifier friendly codes.
Jan 17 2020, 7:35 PM · Restricted Project
yonghong-song updated the diff for D72787: [BPF] Adjust optimizations to generate kernel verifier friendly codes.

Added a machineinstr SSA target phase to add left/aright shift operations if the 32bit subregister is used for sle/slt/sge/sgt operations.

Jan 17 2020, 4:36 PM · Restricted Project

Jan 15 2020

yonghong-song updated the diff for D72787: [BPF] Adjust optimizations to generate kernel verifier friendly codes.

fix potential overflow issues

Jan 15 2020, 11:21 PM · Restricted Project
yonghong-song added a comment to D72787: [BPF] Adjust optimizations to generate kernel verifier friendly codes.

Indeed tried kernel selftests, revert the previous workaround like

diff --git a/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c b/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c
index d22e438198cf..608a06871572 100644
--- a/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c
+++ b/tools/testing/selftests/bpf/progs/test_sysctl_loop1.c
@@ -44,10 +44,7 @@ int sysctl_tcp_mem(struct bpf_sysctl *ctx)
        unsigned long tcp_mem[TCP_MEM_LOOPS] = {};
        char value[MAX_VALUE_STR_LEN];
        unsigned char i, off = 0;
-       /* a workaround to prevent compiler from generating
-        * codes verifier cannot handle yet.
-        */
-       volatile int ret;
+       int ret;
Jan 15 2020, 1:29 PM · Restricted Project
yonghong-song added a comment to D72787: [BPF] Adjust optimizations to generate kernel verifier friendly codes.

The current kernel did not handle signed compare well for 32bit registers. I will need to make that change first in order to make this llvm change effective.

Jan 15 2020, 10:12 AM · Restricted Project
yonghong-song created D72787: [BPF] Adjust optimizations to generate kernel verifier friendly codes.
Jan 15 2020, 10:12 AM · Restricted Project

Jan 10 2020

yonghong-song committed rGfbb64aa69835: [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs (authored by yonghong-song).
[BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs
Jan 10 2020, 9:07 AM
yonghong-song closed D71638: [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs.
Jan 10 2020, 9:07 AM · Restricted Project

Jan 9 2020

yonghong-song updated the diff for D71638: [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs.

To handle cases (exposed when running linux kernel samples/bpf/sockex1) like below:

unsigned long long load_byte(void *skb, unsigned long long off) asm("llvm.bpf.load.byte");
unsigned long long test(void *skb) {
  return load_byte(skb, 10);
}

previous approach emits load_byte as load_byte function is in module function reference list.
But actually this function is not called so we should not emit extern func BTF for this.

Jan 9 2020, 11:57 AM · Restricted Project

Jan 6 2020

yonghong-song updated the diff for D72184: [WIP][BPF] support exchange/compare-and-exchange instruction.

use the same XADD opcode for new instructions.

Jan 6 2020, 5:47 PM · Restricted Project

Jan 3 2020

yonghong-song updated the diff for D72184: [WIP][BPF] support exchange/compare-and-exchange instruction.

implement exchange instruction

Jan 3 2020, 4:57 PM · Restricted Project
yonghong-song created D72184: [WIP][BPF] support exchange/compare-and-exchange instruction.
Jan 3 2020, 2:36 PM · Restricted Project

Jan 2 2020

yonghong-song updated the diff for D71638: [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs.

add a test case for extern function with arguments.

Jan 2 2020, 11:22 PM · Restricted Project
yonghong-song retitled D71638: [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs from [BPF] extern BTF_KIND_FUNC to cover global, static and extern funcs to [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs.
Jan 2 2020, 10:58 AM · Restricted Project

Dec 26 2019

yonghong-song committed rGffd57408efd4: [BPF] Enable relocation location for load/store/shifts (authored by yonghong-song).
[BPF] Enable relocation location for load/store/shifts
Dec 26 2019, 9:10 AM
yonghong-song closed D71790: [BPF] Enable relocation location for load/store/shifts.
Dec 26 2019, 9:10 AM · Restricted Project

Dec 23 2019

yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

@dblaikie The root cause has been identified by @rnk . A clang plugin is used which requires the following patch:

https://github.com/llvm/llvm-project/commit/5128026467cbc17bfc796d94bc8e40e52a9b0752

which has been merged. The original extern variable debug info type has been relanded. So we are good. Thanks!

Dec 23 2019, 10:17 PM · Restricted Project, Restricted Project, debug-info
yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

Could you link to particular bots that have logs showing they ran this test? (perhaps the logs have been retired by now, though - since this patch was reverted :/ - but then at least seeing which bots run BPF tests would be helpful)

Dec 23 2019, 3:00 PM · Restricted Project, Restricted Project, debug-info

Dec 22 2019

yonghong-song added a comment to D71818: reland "[DebugInfo] Support to emit debugInfo for extern variables".

@rnk Great to know the reason. Thanks!

Dec 22 2019, 8:50 PM · Restricted Project, Restricted Project
yonghong-song added a comment to D71818: reland "[DebugInfo] Support to emit debugInfo for extern variables".

@rnk I somehow cannot reproduce the issue locally. If you can let me know how to exactly reproduce the issue, I might be able to also help with some kind of solution, although frankly speaking, I am not a clang expert.

Dec 22 2019, 6:43 PM · Restricted Project, Restricted Project
yonghong-song committed rGe3d8ee35e4ad: reland "[DebugInfo] Support to emit debugInfo for extern variables" (authored by yonghong-song).
reland "[DebugInfo] Support to emit debugInfo for extern variables"
Dec 22 2019, 6:31 PM
yonghong-song closed D71818: reland "[DebugInfo] Support to emit debugInfo for extern variables".
Dec 22 2019, 6:31 PM · Restricted Project, Restricted Project
yonghong-song updated the diff for D71818: reland "[DebugInfo] Support to emit debugInfo for extern variables".

Removed REQUIRES: bpf-registered-target. This is not needed any more if using %clang_cc1. Tested by build clang with and without BPF target.

Dec 22 2019, 3:12 PM · Restricted Project, Restricted Project
yonghong-song added inline comments to D71818: reland "[DebugInfo] Support to emit debugInfo for extern variables".
Dec 22 2019, 2:58 PM · Restricted Project, Restricted Project
yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

@rnk I just submitted a patch https://reviews.llvm.org/D71818 to use %clang_cc1 instead of %clang in the test. Could you check whether this fixed your issue or not?

Dec 22 2019, 2:53 PM · Restricted Project, Restricted Project, debug-info
yonghong-song added a comment to D71818: reland "[DebugInfo] Support to emit debugInfo for extern variables".

I cannot remove BPF target requirement as only BPF target can trigger debug info generation for extern variables. This is by design as discussed in D70696 due to concerns it may blow up debug info binary size for existing applications. This may be relaxed in the future through some flags.
BTW, as far as I know, BPF is enabled for a lot of bots, ubuntu, x86, ppc, arm, etc. So the coverage of this future should be fine.

Dec 22 2019, 2:53 PM · Restricted Project, Restricted Project
yonghong-song created D71818: reland "[DebugInfo] Support to emit debugInfo for extern variables".
Dec 22 2019, 2:49 PM · Restricted Project, Restricted Project

Dec 20 2019

yonghong-song created D71790: [BPF] Enable relocation location for load/store/shifts.
Dec 20 2019, 4:47 PM · Restricted Project

Dec 17 2019

yonghong-song updated the diff for D71638: [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs.

use bpf_type.info lower two bits to encode func scope info

Dec 17 2019, 7:05 PM · Restricted Project
yonghong-song created D71638: [BPF] extend BTF_KIND_FUNC to cover global, static and extern funcs.
Dec 17 2019, 4:49 PM · Restricted Project

Dec 10 2019

yonghong-song closed D71290: [BPF] put not-section-attribute externs into BTF ".extern" data section.

merged.

Dec 10 2019, 2:09 PM · Restricted Project
yonghong-song committed rG7d0e8930ed08: [BPF] put not-section-attribute externs into BTF ".extern" data section (authored by yonghong-song).
[BPF] put not-section-attribute externs into BTF ".extern" data section
Dec 10 2019, 11:51 AM
yonghong-song created D71290: [BPF] put not-section-attribute externs into BTF ".extern" data section.
Dec 10 2019, 11:14 AM · Restricted Project
yonghong-song committed rGd77ae1552fc2: [DebugInfo] Support to emit debugInfo for extern variables (authored by yonghong-song).
[DebugInfo] Support to emit debugInfo for extern variables
Dec 10 2019, 8:10 AM
yonghong-song closed D70696: [DebugInfo] Support to emit debugInfo for extern variables.
Dec 10 2019, 8:10 AM · Restricted Project, Restricted Project, debug-info

Dec 9 2019

yonghong-song committed rG444812500771: [BPF] Support to emit debugInfo for extern variables (authored by yonghong-song).
[BPF] Support to emit debugInfo for extern variables
Dec 9 2019, 10:00 PM
yonghong-song closed D70697: [BPF] Support to emit debugInfo for extern variables.
Dec 9 2019, 10:00 PM · Restricted Project
yonghong-song updated the diff for D70696: [DebugInfo] Support to emit debugInfo for extern variables.

remove some redundant test cases

Dec 9 2019, 5:45 PM · Restricted Project, Restricted Project, debug-info
yonghong-song added inline comments to D70696: [DebugInfo] Support to emit debugInfo for extern variables.
Dec 9 2019, 5:20 PM · Restricted Project, Restricted Project, debug-info
yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

@Jac1494 Based on early discussion, we cannot just issue debuginfo for externs when -g is specified as this may cause debuginfo (and final binary) size bloat. One possible way is to enable it when -fstandalone-debug is specified. @dblaikie can you comment on this patch and general possible forward path for extern variable debug info support?

Dec 9 2019, 11:57 AM · Restricted Project, Restricted Project, debug-info

Dec 7 2019

yonghong-song updated the diff for D70697: [BPF] Support to emit debugInfo for extern variables.

extern variables can have attribute((weak)) attribute. Support it as well.

Dec 7 2019, 11:06 AM · Restricted Project
yonghong-song committed rG5ea611daf9cb: [BPF] Support weak global variables for BTF (authored by yonghong-song).
[BPF] Support weak global variables for BTF
Dec 7 2019, 9:05 AM
yonghong-song closed D71162: [BPF] Support weak global variables for BTF.
Dec 7 2019, 9:05 AM · Restricted Project

Dec 6 2019

yonghong-song created D71162: [BPF] Support weak global variables for BTF.
Dec 6 2019, 11:30 PM · Restricted Project

Dec 5 2019

yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

@dblaikie I consolidated test cases as you suggested. Along the way, I also added some more tests. I already answered some of your questions earlier. Please let me know what you think.

Dec 5 2019, 12:00 PM · Restricted Project, Restricted Project, debug-info
yonghong-song updated the diff for D70696: [DebugInfo] Support to emit debugInfo for extern variables.

consolidated into less test files, added more test cases along the way.

Dec 5 2019, 11:59 AM · Restricted Project, Restricted Project, debug-info

Dec 3 2019

yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

Many of the test cases could be collapsed into one file - using different variables that are used, unused, locally or globally declared, etc.

Dec 3 2019, 5:42 PM · Restricted Project, Restricted Project, debug-info

Dec 2 2019

yonghong-song updated the diff for D70696: [DebugInfo] Support to emit debugInfo for extern variables.

clang-format change (from @aprantl) , add a little details into summary related to recent discussion,
move tests from CodeGenCXX to CodeGen as they are all C tests.

Dec 2 2019, 3:21 PM · Restricted Project, Restricted Project, debug-info
yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

@dblaikie The concern for that users using -fstandalone-debug may suddenly see a bloat of external var debug info is totally valid. Let me just stick to BPF use case for now. If somebody else ever wants this information with -fstandalone-debug, the restriction can be evaluated and relaxed then.

Dec 2 2019, 2:16 PM · Restricted Project, Restricted Project, debug-info
yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

@dblaikie Good points. I will guard external variable debug info generation under -fstandalone-debug flag.

Dec 2 2019, 11:47 AM · Restricted Project, Restricted Project, debug-info
yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

@probinson for the question,

Does bpf require debug info for the declaration of global_var in noref.c ?

No, bpf only cares the referenced external global variables. So my current implementation does not emit debug info
for external global_var in noref.c.

Dec 2 2019, 11:29 AM · Restricted Project, Restricted Project, debug-info
yonghong-song added inline comments to D70696: [DebugInfo] Support to emit debugInfo for extern variables.
Dec 2 2019, 11:29 AM · Restricted Project, Restricted Project, debug-info

Nov 29 2019

yonghong-song added a comment to D70696: [DebugInfo] Support to emit debugInfo for extern variables.

@SouraVX Currently, I filtered all external globals if they are not used. See

for (auto D: ExternalDeclarations) {
  if (!D || D->isInvalidDecl() || D->getPreviousDecl() || !D->isUsed())
    continue;
Nov 29 2019, 8:46 AM · Restricted Project, Restricted Project, debug-info

Nov 25 2019

yonghong-song committed rG6db023b99baa: [BPF] add "llvm." prefix to BPF internally created globals (authored by yonghong-song).
[BPF] add "llvm." prefix to BPF internally created globals
Nov 25 2019, 9:42 PM
yonghong-song closed D70703: [BPF] add "llvm." prefix to BPF internally created globals.
Nov 25 2019, 9:42 PM · Restricted Project
yonghong-song created D70703: [BPF] add "llvm." prefix to BPF internally created globals.
Nov 25 2019, 5:40 PM · Restricted Project
yonghong-song added a comment to D70697: [BPF] Support to emit debugInfo for extern variables.

additional test case is added to ensure debuginfo for externs is indeed generated in BTF.

Nov 25 2019, 2:46 PM · Restricted Project
yonghong-song added a comment to D70697: [BPF] Support to emit debugInfo for extern variables.

The backend supports extern variable debug info as well. The following restrictions in the old code is removed.

 -    // Ignore external globals for now.
-    if (!Global.hasInitializer() && Global.hasExternalLinkage())
-      continue;
Nov 25 2019, 2:46 PM · Restricted Project
yonghong-song abandoned D70625: [DebugInfo][BPF] Support to emit debugInfo for extern variables.

@dblaikie As suggested, just submitted two separate patches:

Nov 25 2019, 2:19 PM · Restricted Project, Restricted Project, debug-info