This is an archive of the discontinued LLVM Phabricator instance.

[Support/ELF] - Added few constants and structs relative to compressed sections.
ClosedPublic

Authored by grimar on May 12 2016, 9:01 AM.

Details

Summary

Patch adds few constants and structs to support compressed sections.

SHF_COMPRESSED intersects with platform specific XCORE_SHF_CP_SECTION,
both has value of 0x800U.

I took SHF_COMPRESSED and other values from glibc:
https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/elf.h;hb=HEAD.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar updated this revision to Diff 57048.May 12 2016, 9:01 AM
grimar retitled this revision from to [Support/ELF] - Added few constants and structs relative to compressed sections..
grimar updated this object.
grimar added reviewers: rafael, davide.
grimar added subscribers: llvm-commits, grimar.
emaste added a subscriber: emaste.May 12 2016, 10:12 AM

You can use http://www.sco.com/developers/gabi/latest/ch4.sheader.html as the canonical reference rather than glibc source

ruiu accepted this revision.May 12 2016, 10:19 AM
ruiu added a reviewer: ruiu.
ruiu added a subscriber: ruiu.

As Ed wrote, please refer the official document in the commit message. With that, LGTM.

This revision is now accepted and ready to land.May 12 2016, 10:19 AM
davide accepted this revision.May 12 2016, 11:11 AM
davide edited edge metadata.

LGTM after Ed's comment is addressed, thanks.

grimar added a comment.EditedMay 13 2016, 3:19 AM

You can use http://www.sco.com/developers/gabi/latest/ch4.sheader.html as the canonical reference rather than glibc source

Right. What I really wanted to say is that since "SHF_COMPRESSED intersects with platform specific XCORE_SHF_CP_SECTION," then SHF_COMPRESSED looks to be correct as glibc uses that right now. I am not sure what is XCORE_SHF_CP_SECTION and if it is correct that it has the same value.
llvm-readobj currently parses ELFs with compressed sections like:

  Section {
    Index: 16
    Name: .debug_str (163)
    Type: SHT_PROGBITS (0x1)
    Flags [ (0x830)
      SHF_MERGE (0x10)
      SHF_STRINGS (0x20)
      XCORE_SHF_CP_SECTION (0x800)
    ]
...

I think XCORE_SHF_CP_SECTION should be changed to SHF_COMPRESSED (this patch allows to do that), but I do not yet know will that affect on something that probably uses XCORE_SHF_CP_SECTION (I mean if some test check that constant name). I wonder if "_CP_" means ComPressed either ? Why the 'duplication' of the flag is requred then ?

Ah, according to comment CP is constant pool.

This revision was automatically updated to reflect the committed changes.