Use .rdata as section name for asm targeting COFF

.rdata is the default section which hosts read-only data for COFF. Use this
default section name avoids creating a new .rodata section with explicit
read-only property.

Bug: chromium:919180
Change-Id: I7325cbcfdb142b3ee15de93b7881f755c365d6e6
Reviewed-on: https://chromium-review.googlesource.com/c/1407240
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58764}
This commit is contained in:
Tom Tan 2019-01-11 17:42:47 -08:00 committed by Commit Bot
parent 3d47306487
commit 485136287e
2 changed files with 1 additions and 4 deletions

View File

@ -347,8 +347,7 @@ void PlatformDependentEmbeddedFileWriter::SectionData() {
void PlatformDependentEmbeddedFileWriter::SectionRoData() { void PlatformDependentEmbeddedFileWriter::SectionRoData() {
#if defined(V8_OS_WIN) #if defined(V8_OS_WIN)
// .rodata defaults to r/w in COFF, but read only in ELF. fprintf(fp_, ".section .rdata\n");
fprintf(fp_, ".section .rodata,\"r\"\n");
#else #else
fprintf(fp_, ".section .rodata\n"); fprintf(fp_, ".section .rodata\n");
#endif #endif

View File

@ -17,8 +17,6 @@ def asm_to_inl_asm(in_filename, out_filename):
with open(in_filename, 'r') as infile, open(out_filename, 'wb') as outfile: with open(in_filename, 'r') as infile, open(out_filename, 'wb') as outfile:
outfile.write('__asm__(\n') outfile.write('__asm__(\n')
for line in infile: for line in infile:
# Escape " in .S file before output it to inline asm file.
line = line.replace('"', '\\"')
outfile.write(' "%s\\n"\n' % line.rstrip()) outfile.write(' "%s\\n"\n' % line.rstrip())
outfile.write(');\n') outfile.write(');\n')
return 0 return 0