[PATCH] D58840: ELF: Change FileSize back to a uint64_t.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 1 10:53:04 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL355218: ELF: Change FileSize back to a uint64_t. (authored by pcc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D58840?vs=188943&id=188945#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58840/new/
https://reviews.llvm.org/D58840
Files:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/linkerscript/output-too-large-32bit.s
lld/trunk/test/lit.cfg.py
lld/trunk/test/lit.site.cfg.py.in
llvm/trunk/utils/gn/secondary/lld/test/BUILD.gn
Index: llvm/trunk/utils/gn/secondary/lld/test/BUILD.gn
===================================================================
--- llvm/trunk/utils/gn/secondary/lld/test/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/lld/test/BUILD.gn
@@ -53,6 +53,12 @@
} else {
extra_values += [ "HAVE_LIBZ=0" ] # Must be 0.
}
+
+ if (current_cpu == "x64" || current_cpu == "arm64") {
+ extra_values += [ "CMAKE_SIZEOF_VOID_P=8" ]
+ } else {
+ extra_values += [ "CMAKE_SIZEOF_VOID_P=4" ]
+ }
}
write_lit_cfg("lit_unit_site_cfg") {
Index: lld/trunk/test/lit.cfg.py
===================================================================
--- lld/trunk/test/lit.cfg.py
+++ lld/trunk/test/lit.cfg.py
@@ -97,6 +97,9 @@
if config.have_dia_sdk:
config.available_features.add("diasdk")
+if config.sizeof_void_p == 8:
+ config.available_features.add("llvm-64-bits")
+
tar_executable = lit.util.which('tar', config.environment['PATH'])
if tar_executable:
tar_version = subprocess.Popen(
Index: lld/trunk/test/ELF/linkerscript/output-too-large-32bit.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/output-too-large-32bit.s
+++ lld/trunk/test/ELF/linkerscript/output-too-large-32bit.s
@@ -0,0 +1,11 @@
+# REQUIRES: x86 && !llvm-64-bits
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
+# RUN: echo "SECTIONS { .text : { . = 0x6fffffffffffffff; *(.text*); } }" > %t.script
+# RUN: not ld.lld --no-check-sections --script %t.script %t.o -o /dev/null 2>&1 | FileCheck %s
+
+# CHECK: output file too large
+
+.global _start
+_start:
+ nop
Index: lld/trunk/test/lit.site.cfg.py.in
===================================================================
--- lld/trunk/test/lit.site.cfg.py.in
+++ lld/trunk/test/lit.site.cfg.py.in
@@ -15,6 +15,7 @@
config.target_triple = "@TARGET_TRIPLE@"
config.python_executable = "@PYTHON_EXECUTABLE@"
config.have_zlib = @HAVE_LIBZ@
+config.sizeof_void_p = @CMAKE_SIZEOF_VOID_P@
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -82,7 +82,7 @@
std::vector<PhdrEntry *> Phdrs;
- size_t FileSize;
+ uint64_t FileSize;
uint64_t SectionHeaderOff;
};
} // anonymous namespace
@@ -2480,7 +2480,7 @@
// Open a result file.
template <class ELFT> void Writer<ELFT>::openFile() {
uint64_t MaxSize = Config->Is64 ? INT64_MAX : UINT32_MAX;
- if (MaxSize < FileSize) {
+ if (FileSize != size_t(FileSize) || MaxSize < FileSize) {
error("output file too large: " + Twine(FileSize) + " bytes");
return;
}
@@ -2561,7 +2561,7 @@
return;
// Compute a hash of all sections of the output file.
- In.BuildId->writeBuildId({Out::BufferStart, FileSize});
+ In.BuildId->writeBuildId({Out::BufferStart, size_t(FileSize)});
}
template void elf::writeResult<ELF32LE>();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58840.188945.patch
Type: text/x-patch
Size: 3069 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190301/c4b9652b/attachment.bin>
More information about the llvm-commits
mailing list