Index: lld/trunk/test/COFF/Inputs/combined-resources-2.rc =================================================================== --- lld/trunk/test/COFF/Inputs/combined-resources-2.rc +++ lld/trunk/test/COFF/Inputs/combined-resources-2.rc @@ -0,0 +1,36 @@ +#include "windows.h" + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +randomdat RCDATA +{ + "this is a random bit of data that means nothing\0", + 0x23a9, + 0x140e, + 194292, +} + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +randomdat RCDATA +{ + "zhe4 shi4 yi1ge4 sui2ji1 de shu4ju4, zhe4 yi4wei4zhe shen2me\0", + 0x23a9, + 0x140e, + 194292, +} + +LANGUAGE LANG_GERMAN, SUBLANG_GERMAN_LUXEMBOURG +randomdat RCDATA +{ + "Dies ist ein zufälliges Bit von Daten, die nichts bedeutet\0", + 0x23a9, + 0x140e, + 194292, +} + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +myaccelerators ACCELERATORS +{ + "^C", 999, VIRTKEY, ALT + "D", 1100, VIRTKEY, CONTROL, SHIFT + "^R", 444, ASCII, NOINVERT +} Index: lld/trunk/test/COFF/Inputs/combined-resources.rc =================================================================== --- lld/trunk/test/COFF/Inputs/combined-resources.rc +++ lld/trunk/test/COFF/Inputs/combined-resources.rc @@ -0,0 +1,50 @@ +#include "windows.h" + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +myaccelerators ACCELERATORS +{ + "^C", 999, VIRTKEY, ALT + "D", 1100, VIRTKEY, CONTROL, SHIFT + "^R", 444, ASCII, NOINVERT +} + +cursor BITMAP "combined-resources-cursor.bmp" +okay BITMAP "combined-resources-okay.bmp" + +14432 MENU +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED +{ + MENUITEM "yu", 100 + MENUITEM "shala", 101 + MENUITEM "kaoya", 102 +} + +testdialog DIALOG 10, 10, 200, 300 +STYLE WS_POPUP | WS_BORDER +CAPTION "Test" +{ + CTEXT "Continue:", 1, 10, 10, 230, 14 + PUSHBUTTON "&OK", 2, 66, 134, 161, 13 +} + +12 ACCELERATORS +{ + "X", 164, VIRTKEY, ALT + "H", 5678, VIRTKEY, CONTROL, SHIFT + "^R", 444, ASCII, NOINVERT +} + +"eat" MENU +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS +{ + MENUITEM "fish", 100 + MENUITEM "salad", 101 + MENUITEM "duck", 102 +} + + +myresource stringarray { + "this is a user defined resource\0", + "it contains many strings\0", +} Index: lld/trunk/test/COFF/combined-resources.test =================================================================== --- lld/trunk/test/COFF/combined-resources.test +++ lld/trunk/test/COFF/combined-resources.test @@ -0,0 +1,17 @@ +// Check that lld properly handles merging multiple .res files. +// The inputs were generated with the following commands, using the original +// Windows rc.exe +// > rc /fo combined-resources.res /nologo combined-resources.rc +// > rc /fo combined-resources-2.res /nologo combined-resources-2.rc + +# RUN: yaml2obj < %p/Inputs/ret42.yaml > %t.obj +# RUN: lld-link /out:%t.exe /entry:main %t.obj %p/Inputs/resource.res \ +# RUN: %p/Inputs/combined-resources.res %p/Inputs/combined-resources-2.res + +# RUN: llvm-readobj -coff-resources -file-headers %t.exe | FileCheck %s + + +CHECK: ResourceTableRVA: 0x1000 +CHECK-NEXT: ResourceTableSize: 0xC1C +CHECK-DAG: Resources [ +CHECK-NEXT: Total Number of Resources: 13 Index: lld/trunk/test/COFF/resource.test =================================================================== --- lld/trunk/test/COFF/resource.test +++ lld/trunk/test/COFF/resource.test @@ -6,7 +6,28 @@ EXE: {{H.e.l.l.o}} -# RUN: llvm-readobj -file-headers %t.exe | FileCheck --check-prefix=HEADER %s +# Verify the resource tree layout in the final executable. +# RUN: llvm-readobj -file-headers -coff-resources %t.exe | FileCheck \ +# RUN: --check-prefix=RESOURCE_INFO %s -HEADER: ResourceTableRVA: 0x1000 -HEADER: ResourceTableSize: 0x88 +RESOURCE_INFO: ResourceTableRVA: 0x1000 +RESOURCE_INFO-NEXT: ResourceTableSize: 0x88 +RESOURCE_INFO-DAG: Resources [ +RESOURCE_INFO-NEXT: Total Number of Resources: 1 +RESOURCE_INFO-NEXT: Base Table Address: 0x400 +RESOURCE_INFO-DAG: Number of String Entries: 0 +RESOURCE_INFO-NEXT: Number of ID Entries: 1 +RESOURCE_INFO-NEXT: Type: kRT_STRING (ID 6) [ +RESOURCE_INFO-NEXT: Table Offset: 0x18 +RESOURCE_INFO-NEXT: Number of String Entries: 0 +RESOURCE_INFO-NEXT: Number of ID Entries: 1 +RESOURCE_INFO-NEXT: Name: (ID 1) [ +RESOURCE_INFO-NEXT: Table Offset: 0x30 +RESOURCE_INFO-NEXT: Number of String Entries: 0 +RESOURCE_INFO-NEXT: Number of ID Entries: 1 +RESOURCE_INFO-NEXT: Language: (ID 1033) [ +RESOURCE_INFO-NEXT: Entry Offset: 0x48 +RESOURCE_INFO-NEXT: Time/Date Stamp: 1970-01-01 00:00:00 (0x0) +RESOURCE_INFO-NEXT: Major Version: 0 +RESOURCE_INFO-NEXT: Minor Version: 0 +RESOURCE_INFO-NEXT: Characteristics: 0