File tree Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ struct Configuration {
218
218
bool warnMissingOrderSymbol = true ;
219
219
bool warnLocallyDefinedImported = true ;
220
220
bool warnDebugInfoUnusable = true ;
221
+ bool warnLongSectionNames = true ;
221
222
bool incremental = true ;
222
223
bool integrityCheck = false ;
223
224
bool killAt = false ;
Original file line number Diff line number Diff line change @@ -1188,6 +1188,8 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
1188
1188
config->warnDebugInfoUnusable = false ;
1189
1189
else if (s == " 4217" )
1190
1190
config->warnLocallyDefinedImported = false ;
1191
+ else if (s == " longsections" )
1192
+ config->warnLongSectionNames = false ;
1191
1193
// Other warning numbers are ignored.
1192
1194
}
1193
1195
}
@@ -1527,6 +1529,11 @@ void LinkerDriver::link(ArrayRef<const char *> argsArr) {
1527
1529
config->debugGHashes = debug == DebugKind::GHash;
1528
1530
config->debugSymtab = debug == DebugKind::Symtab;
1529
1531
1532
+ // Don't warn about long section names, such as .debug_info, for mingw or when
1533
+ // -debug:dwarf is requested.
1534
+ if (config->mingw || config->debugDwarf )
1535
+ config->warnLongSectionNames = false ;
1536
+
1530
1537
config->mapFile = getMapFile (args);
1531
1538
1532
1539
if (config->incremental && args.hasArg (OPT_profile)) {
Original file line number Diff line number Diff line change @@ -1148,6 +1148,11 @@ void Writer::createSymbolAndStringTable() {
1148
1148
continue ;
1149
1149
if ((sec->header .Characteristics & IMAGE_SCN_MEM_DISCARDABLE) == 0 )
1150
1150
continue ;
1151
+ if (config->warnLongSectionNames ) {
1152
+ warn (" section name " + sec->name +
1153
+ " is longer than 8 characters and will use a non-standard string "
1154
+ " table" );
1155
+ }
1151
1156
sec->setStringTableOff (addEntryToStringTable (sec->name ));
1152
1157
}
1153
1158
Original file line number Diff line number Diff line change 1
1
# RUN: yaml2obj < %s > %t.obj
2
- # RUN: lld-link /out:%t.exe /entry:main %t.obj
2
+ # RUN: lld-link /out:%t.exe /entry:main %t.obj 2>&1 | FileCheck %s --check-prefix=WARN
3
3
# RUN: llvm-readobj --sections %t.exe | FileCheck %s
4
- # RUN: lld-link /debug /out:%t2.exe /entry:main %t.obj
4
+ # RUN: lld-link /debug /out:%t2.exe /entry:main %t.obj 2>&1 | FileCheck %s --check-prefix=WARN
5
5
# RUN: llvm-readobj --sections %t2.exe | FileCheck %s
6
+ #
7
+ # No warnings in mingw mode or with ignore flag.
8
+ # RUN: lld-link /out:%t.exe /entry:main %t.obj /ignore:longsections 2>&1 | FileCheck %s --check-prefix=IGNORE --allow-empty
9
+ # RUN: lld-link /out:%t.exe /entry:main %t.obj -lldmingw 2>&1 | FileCheck %s --check-prefix=IGNORE --allow-empty
10
+ # RUN: lld-link /out:%t.exe /entry:main %t.obj -debug:dwarf 2>&1 | FileCheck %s --check-prefix=IGNORE --allow-empty
11
+
12
+ # WARN: warning: section name .data_long_section_name is longer than 8 characters and will use a non-standard string table
13
+ # WARN: warning: section name .text_long_section_name is longer than 8 characters and will use a non-standard string table
14
+
15
+ # IGNORE-NOT: warning:
6
16
7
17
# CHECK: Name: .eh_fram (
8
18
# CHECK: Name: .data_long_section_name
You can’t perform that action at this time.
0 commit comments