brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · a9f279c Raw
128 lines · plain
1## Show that if --remove-section is given, llvm-objcopy removes sections2## specified by the option.3 4# RUN: yaml2obj %s -o %t5 6## Remove only __TEXT,__text section.7# RUN: llvm-objcopy --remove-section __TEXT,__text %t %t28# RUN: llvm-readobj --sections --section-data %t2 \9# RUN:   | FileCheck %s --check-prefixes=COMMON,REMOVE-TEXT-ONLY10 11## Remove multiple sections.12# RUN: llvm-objcopy --remove-section __TEXT,__text --remove-section __DATA,__data %t %t313# RUN: llvm-readobj --sections --section-data %t3 \14# RUN:   | FileCheck %s --check-prefixes=COMMON,REMOVE-TEXT-AND-DATA15 16# COMMON:                    Sections [17# REMOVE-TEXT-ONLY-NEXT:       Section {18# REMOVE-TEXT-ONLY-NEXT:         Index: 019# REMOVE-TEXT-ONLY-NEXT:         Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00)20# REMOVE-TEXT-ONLY-NEXT:         Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)21# REMOVE-TEXT-ONLY-NEXT:         Address: 0x422# REMOVE-TEXT-ONLY-NEXT:         Size: 0x423# REMOVE-TEXT-ONLY-NEXT:         Offset: 26424# REMOVE-TEXT-ONLY-NEXT:         Alignment: 025# REMOVE-TEXT-ONLY-NEXT:         RelocationOffset: 0x026# REMOVE-TEXT-ONLY-NEXT:         RelocationCount: 027# REMOVE-TEXT-ONLY-NEXT:         Type: Regular (0x0)28# REMOVE-TEXT-ONLY-NEXT:         Attributes [ (0x0)29# REMOVE-TEXT-ONLY-NEXT:         ]30# REMOVE-TEXT-ONLY-NEXT:         Reserved1: 0x031# REMOVE-TEXT-ONLY-NEXT:         Reserved2: 0x032# REMOVE-TEXT-ONLY-NEXT:         Reserved3: 0x033# REMOVE-TEXT-ONLY-NEXT:         SectionData (34# REMOVE-TEXT-ONLY-NEXT:           0000: DDAADDAA                             |....|35# REMOVE-TEXT-ONLY-NEXT:         )36# REMOVE-TEXT-ONLY-NEXT:       }37# COMMON-NEXT:                 Section {38# REMOVE-TEXT-ONLY-NEXT:         Index: 139# REMOVE-TEXT-AND-DATA-NEXT:     Index: 040# COMMON-NEXT:                   Name: __const (5F 5F 63 6F 6E 73 74 00 00 00 00 00 00 00 00 00)41# COMMON-NEXT:                   Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)42# COMMON-NEXT:                   Address: 0x843# COMMON-NEXT:                   Size: 0x444# REMOVE-TEXT-ONLY-NEXT:         Offset: 26845# REMOVE-TEXT-AND-DATA-NEXT:     Offset: 18446# COMMON-NEXT:                   Alignment: 047# COMMON-NEXT:                   RelocationOffset: 0x048# COMMON-NEXT:                   RelocationCount: 049# COMMON-NEXT:                   Type: Regular (0x0)50# COMMON-NEXT:                   Attributes [ (0x0)51# COMMON-NEXT:                   ]52# COMMON-NEXT:                   Reserved1: 0x053# COMMON-NEXT:                   Reserved2: 0x054# COMMON-NEXT:                   Reserved3: 0x055# COMMON-NEXT:                   SectionData (56# COMMON-NEXT:                     0000: EEFFEEFF                             |....|57# COMMON-NEXT:                   )58# COMMON-NEXT:                 }59# COMMON-NEXT:               ]60 61## Keep all sections if the specified section name is not present in the62## input. The output file should be the same as the input.63# RUN: llvm-objcopy --remove-section __TEXT,__foo %t %t464# RUN: cmp %t %t465 66--- !mach-o67FileHeader:68  magic:           0xFEEDFACF69  cputype:         0x0100000770  cpusubtype:      0x0000000371  filetype:        0x0000000172  ncmds:           173  sizeofcmds:      31274  flags:           0x0000200075  reserved:        0x0000000076LoadCommands:77  - cmd:             LC_SEGMENT_6478    cmdsize:         31279    segname:         ''80    vmaddr:          081    vmsize:          1282    fileoff:         34483    filesize:        1284    maxprot:         785    initprot:        786    nsects:          387    flags:           088    Sections:89      - sectname:        __text90        segname:         __TEXT91        addr:            0x000000000000000092        content:         'AABBCCDD'93        size:            494        offset:          34495        align:           096        reloff:          0x0000000097        nreloc:          098        flags:           0x8000040099        reserved1:       0x00000000100        reserved2:       0x00000000101        reserved3:       0x00000000102      - sectname:        __data103        segname:         __DATA104        addr:            0x0000000000000004105        content:         'DDAADDAA'106        size:            4107        offset:          348108        align:           0109        reloff:          0x00000000110        nreloc:          0111        flags:           0x00000000112        reserved1:       0x00000000113        reserved2:       0x00000000114        reserved3:       0x00000000115      - sectname:        __const116        segname:         __TEXT117        addr:            0x0000000000000008118        content:         'EEFFEEFF'119        size:            4120        offset:          352121        align:           0122        reloff:          0x00000000123        nreloc:          0124        flags:           0x00000000125        reserved1:       0x00000000126        reserved2:       0x00000000127        reserved3:       0x00000000128