Hello,

Paul, thank you for your help. I’m Yutaro a reporter of this issue.

> 
> On Mon, Sep 17, 2018 at 3:46 PM Alexei Starovoitov
> <[email protected]> wrote:
>> 
>> On Mon, Sep 17, 2018 at 11:29:13PM +0200, Paul Chaignon wrote:
>>> I am sending here as an RFC instead of LLVM's mailing list as I'm not sure
>>> this is the intended behavior, and the "fix" may therefore not be needed.
>>> 
>>> Clang-compiled object files currently don't include the symbol sizes and
>>> types.  Some tools however need that information.  For example, ctfconvert
>>> uses that information to generate FreeBSD's CTF representation from ELF
>>> files.
>>> With this patch, that information is included in object files.
>>> 
>>> Signed-off-by: Paul Chaignon <[email protected]>
>>> Reported-by: Yutaro Hayakawa <[email protected]>
>>> ---
>>> Index: lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h
>>> ===================================================================
>>> --- lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h        (revision 341679)
>>> +++ lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h        (working copy)
>>> @@ -30,8 +30,8 @@
>>>     WeakRefDirective = "\t.weak\t";
>>> 
>>>     UsesELFSectionDirectiveForBSS = true;
>>> -    HasSingleParameterDotFile = false;
>>> -    HasDotTypeDotSizeDirective = false;
>>> +    HasSingleParameterDotFile = true;
>>> +    HasDotTypeDotSizeDirective = true;
>>> 
>>>     SupportsDebugInformation = true;
>>>     ExceptionsType = ExceptionHandling::DwarfCFI;
>> 
>> make sense to me, but I wonder why pahole's dwarf->btf converter
>> doesn't have this issue.
>> Could you describe what exactly are you trying to do with llvm generated elf 
>> file?
> 
> Currently, BTF does not deal with symbols, so that is why it is okay.
> llvm-objdump does not need symbol size either. It only needs symbol offset.
> that is why we did not have issues so far.
> 
> In my future proposed func support in BTF, I also need offset only.
> 
> In your use case, the size is merely to satisfy conversion to CTF or there
> are some other needs? What did you do with CTF?

Describing the background, I’m trying to port eBPF to FreeBSD 
(https://github.com/YutaroHayakawa/generic-ebpf 
<https://github.com/YutaroHayakawa/generic-ebpf>)

What I want to do with CTF is very similar to that of BTF, but I currently 
focusing on assisting verification. Since FreeBSD
already has library to deal with CTF, we prefer to use CTF instead of BTF.

In FreeBSD, we usually use tool called ctfconvert 
(https://www.freebsd.org/cgi/man.cgi?query=ctfconvert&sektion=1&apropos=0&manpath=FreeBSD+10.0-RELEASE
 
<https://www.freebsd.org/cgi/man.cgi?query=ctfconvert&sektion=1&apropos=0&manpath=FreeBSD+10.0-RELEASE>)
 to generate CTF.

And the problem is ctfconvert is aware of symbol type and size. It cannot 
generate correct CTF if they were missing.

To solve this issue I need the change.

Regards,
Yutaro


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#1481): https://lists.iovisor.org/g/iovisor-dev/message/1481
Mute This Topic: https://lists.iovisor.org/mt/25729284/21656
Group Owner: [email protected]
Unsubscribe: https://lists.iovisor.org/g/iovisor-dev/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to