|
455 | 455 | dest='node_use_large_pages_script_lld',
|
456 | 456 | help='This option has no effect. --use-largepages is now a runtime option.')
|
457 | 457 |
|
| 458 | +parser.add_option('--use-section-ordering-file', |
| 459 | + action='store', |
| 460 | + dest='node_section_ordering_info', |
| 461 | + default='', |
| 462 | + help='Pass a section ordering file to the linker. This requires that ' + |
| 463 | + 'Node.js be linked using the gold linker. The gold linker must have ' + |
| 464 | + 'version 1.2 or greater.') |
| 465 | + |
458 | 466 | intl_optgroup.add_option('--with-intl',
|
459 | 467 | action='store',
|
460 | 468 | dest='with_intl',
|
@@ -1709,6 +1717,29 @@ def configure_inspector(o):
|
1709 | 1717 | options.without_ssl)
|
1710 | 1718 | o['variables']['v8_enable_inspector'] = 0 if disable_inspector else 1
|
1711 | 1719 |
|
| 1720 | +def configure_section_file(o): |
| 1721 | + try: |
| 1722 | + proc = subprocess.Popen(['ld.gold'] + ['-v'], stdin = subprocess.PIPE, |
| 1723 | + stdout = subprocess.PIPE, stderr = subprocess.PIPE) |
| 1724 | + except OSError: |
| 1725 | + warn('''No acceptable ld.gold linker found!''') |
| 1726 | + return 0 |
| 1727 | + |
| 1728 | + match = re.match(r"^GNU gold.*([0-9]+)\.([0-9]+)$", |
| 1729 | + proc.communicate()[0].decode("utf-8")) |
| 1730 | + |
| 1731 | + if match: |
| 1732 | + gold_major_version = match.group(1) |
| 1733 | + gold_minor_version = match.group(2) |
| 1734 | + if int(gold_major_version) == 1 and int(gold_minor_version) <= 1: |
| 1735 | + error('''GNU gold version must be greater than 1.2 in order to use section |
| 1736 | + reordering''') |
| 1737 | + |
| 1738 | + if options.node_section_ordering_info != "": |
| 1739 | + o['variables']['node_section_ordering_info'] = os.path.realpath( |
| 1740 | + str(options.node_section_ordering_info)) |
| 1741 | + else: |
| 1742 | + o['variables']['node_section_ordering_info'] = "" |
1712 | 1743 |
|
1713 | 1744 | def make_bin_override():
|
1714 | 1745 | if sys.platform == 'win32':
|
@@ -1774,6 +1805,7 @@ def make_bin_override():
|
1774 | 1805 | configure_intl(output)
|
1775 | 1806 | configure_static(output)
|
1776 | 1807 | configure_inspector(output)
|
| 1808 | +configure_section_file(output) |
1777 | 1809 |
|
1778 | 1810 | # Forward OSS-Fuzz settings
|
1779 | 1811 | output['variables']['ossfuzz'] = b(options.ossfuzz)
|
|
0 commit comments