|
498 | 498 | dest='node_use_large_pages_script_lld',
|
499 | 499 | help='This option has no effect. --use-largepages is now a runtime option.')
|
500 | 500 |
|
| 501 | +parser.add_option('--use-section-ordering-file', |
| 502 | + action='store', |
| 503 | + dest='node_section_ordering_info', |
| 504 | + default='', |
| 505 | + help='Pass a section ordering file to the linker. This requires that ' + |
| 506 | + 'Node.js be linked using the gold linker. The gold linker must have ' + |
| 507 | + 'version 1.2 or greater.') |
| 508 | + |
501 | 509 | intl_optgroup.add_option('--with-intl',
|
502 | 510 | action='store',
|
503 | 511 | dest='with_intl',
|
@@ -1748,6 +1756,29 @@ def configure_inspector(o):
|
1748 | 1756 | options.without_ssl)
|
1749 | 1757 | o['variables']['v8_enable_inspector'] = 0 if disable_inspector else 1
|
1750 | 1758 |
|
| 1759 | +def configure_section_file(o): |
| 1760 | + try: |
| 1761 | + proc = subprocess.Popen(['ld.gold'] + ['-v'], stdin = subprocess.PIPE, |
| 1762 | + stdout = subprocess.PIPE, stderr = subprocess.PIPE) |
| 1763 | + except OSError: |
| 1764 | + warn('''No acceptable ld.gold linker found!''') |
| 1765 | + return 0 |
| 1766 | + |
| 1767 | + match = re.match(r"^GNU gold.*([0-9]+)\.([0-9]+)$", |
| 1768 | + proc.communicate()[0].decode("utf-8")) |
| 1769 | + |
| 1770 | + if match: |
| 1771 | + gold_major_version = match.group(1) |
| 1772 | + gold_minor_version = match.group(2) |
| 1773 | + if int(gold_major_version) == 1 and int(gold_minor_version) <= 1: |
| 1774 | + error('''GNU gold version must be greater than 1.2 in order to use section |
| 1775 | + reordering''') |
| 1776 | + |
| 1777 | + if options.node_section_ordering_info != "": |
| 1778 | + o['variables']['node_section_ordering_info'] = os.path.realpath( |
| 1779 | + str(options.node_section_ordering_info)) |
| 1780 | + else: |
| 1781 | + o['variables']['node_section_ordering_info'] = "" |
1751 | 1782 |
|
1752 | 1783 | def make_bin_override():
|
1753 | 1784 | if sys.platform == 'win32':
|
@@ -1813,6 +1844,7 @@ def make_bin_override():
|
1813 | 1844 | configure_intl(output)
|
1814 | 1845 | configure_static(output)
|
1815 | 1846 | configure_inspector(output)
|
| 1847 | +configure_section_file(output) |
1816 | 1848 |
|
1817 | 1849 | # Forward OSS-Fuzz settings
|
1818 | 1850 | output['variables']['ossfuzz'] = b(options.ossfuzz)
|
|
0 commit comments