tbb-commits
Threads by month
- ----- 2026 -----
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 1 participants
- 20124 discussions
commit 2a501682217eff74df47f45c60618b71f2a38353
Author: Alex Catarineu <acat(a)torproject.org>
Date: Mon May 13 18:30:50 2019 +0200
Remove unused files
---
src/chrome/content/popup.xul | 43 ----
src/chrome/content/pref-connection.xul | 10 -
src/chrome/content/torbutton_tb.xul | 38 ----
src/chrome/content/torcookie.js | 385 ---------------------------------
src/chrome/content/torcookiedialog.xul | 72 ------
5 files changed, 548 deletions(-)
diff --git a/src/chrome/content/popup.xul b/src/chrome/content/popup.xul
deleted file mode 100644
index 5d9b76ce..00000000
--- a/src/chrome/content/popup.xul
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://torbutton/skin/torbutton.css" type="text/css"?>
-
-<!DOCTYPE overlay SYSTEM "chrome://torbutton/locale/torbutton.dtd">
-
-<overlay id="torbutton-popup-overlay"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
- <stringbundleset id="torbutton-stringbundleset">
- <stringbundle id="torbutton-bundle" src="chrome://torbutton/locale/torbutton.properties"/>
- </stringbundleset>
- <panel id="torbutton-context-menu"
- onpopupshowing="torbutton_check_protections();"
- titlebar="normal" noautohide="true"
- anchor="torbutton-button" position="after_start" >
- <hbox align="start">
- <vbox>
- <menuitem id="torbutton-new-identity"
- label="&torbutton.context_menu.new_identity;"
- accesskey="&torbutton.context_menu.new_identity_key;"
- insertafter="context-stop"
- oncommand="torbutton_new_identity()"/>
- <menuseparator/>
- <menuitem id="torbutton-cookie-protector"
- label="&torbutton.context_menu.cookieProtections;"
- accesskey="&torbutton.context_menu.cookieProtections.key;"
- insertafter="context-stop"
- hidden="true"
- oncommand="torbutton_open_cookie_dialog()"/>
- <menuitem id="torbutton-networksettings"
- label="&torbutton.context_menu.networksettings;"
- accesskey="&torbutton.context_menu.networksettings.key;"
- oncommand="torbutton_open_network_settings()"/>
- <menuseparator id="torbutton-checkForUpdateSeparator"/>
- <menuitem id="torbutton-checkForUpdate"
- label="&torbutton.context_menu.downloadUpdate;"
- accesskey="&torbutton.context_menu.downloadUpdate.key;"
- insertafter="context-stop"
- oncommand="torbutton_check_for_update()"/>
- </vbox>
- </hbox>
- </panel>
-</overlay>
diff --git a/src/chrome/content/pref-connection.xul b/src/chrome/content/pref-connection.xul
deleted file mode 100644
index 4d5fb613..00000000
--- a/src/chrome/content/pref-connection.xul
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- TODO: This entire file could be removed, but see bug 19929. -->
-
-<!DOCTYPE overlay SYSTEM "chrome://torbutton/locale/torbutton.dtd">
-
-<overlay id="torbutton-prefs-notice"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-</overlay>
diff --git a/src/chrome/content/torbutton_tb.xul b/src/chrome/content/torbutton_tb.xul
deleted file mode 100644
index 450ffb3a..00000000
--- a/src/chrome/content/torbutton_tb.xul
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://torbutton/skin/torbutton.css" type="text/css"?>
-<?xul-overlay href="chrome://torbutton/content/popup.xul"?>
-
-<!DOCTYPE overlay SYSTEM "chrome://torbutton/locale/torbutton.dtd">
-
-<overlay id="torbutton-overlay"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/x-javascript" src="chrome://torbutton/content/torbutton_util.js" />
- <script type="application/x-javascript" src="chrome://torbutton/content/torbutton.js" />
- <script language="JavaScript">
- //onLoad Hander
- try{window.addEventListener("load", torbutton_init, false);}catch(e){}
- </script>
-
- <stringbundleset id="torbutton-stringbundleset">
- <stringbundle id="torbutton-bundle" src="chrome://torbutton/locale/torbutton.properties"/>
- </stringbundleset>
-
- <toolbarpalette id="MailToolbarPalette">
- <toolbarbutton
- id="torbutton-button-tb"
- class="toolbarbutton-1"
- label="Torbutton"
- tooltiptext="&torbutton.button.tooltip;"
- context="torbutton-context-menu" />
- </toolbarpalette>
-
- <toolbarpalette id="MsgComposeToolbarPalette">
- <toolbarbutton
- id="torbutton-button-tb-msg"
- class="toolbarbutton-1"
- label="Torbutton"
- tooltiptext="&torbutton.button.tooltip;"
- context="torbutton-context-menu" />
- </toolbarpalette>
-
-</overlay>
diff --git a/src/chrome/content/torcookie.js b/src/chrome/content/torcookie.js
deleted file mode 100644
index 0a3dace6..00000000
--- a/src/chrome/content/torcookie.js
+++ /dev/null
@@ -1,385 +0,0 @@
-// Bug 1506 P2: I think cookie protections is a neat feature.
-
-var cookiesTree = null;
-var prefs = null;
-var cookies = [];
-var protectedCookies = [];
-var deletedCookies = [];
-var lastCookieSortColumn = "";
-var lastCookieSortAscending = false;
-var cookiemanager = null;
-var selector = null;
-//custom tree view, this is how we dynamically add the cookies
-var cookiesTreeView = {
- rowCount : 0,
- setTree : function(tree){},
- getImageSrc : function(row,column) {},
- getProgressMode : function(row,column) {},
- getCellValue : function(row,column) {},
- getCellText : function(row,column){
- var rv="";
- switch (column.id) {
- case "domainCol" : rv = cookies[row].rawHost; break;
- case "nameCol" : rv = cookies[row].name; break;
- case "lockCol" : rv = cookies[row].isProtected; break;
- case "pathCol" : rv = cookies[row].path; break;
- }
- return rv;
- },
- isSeparator : function(index) {return false;},
- isSorted: function() { return false; },
- isContainer : function(index) {return false;},
- cycleHeader : function(column, aElt) {},
- getRowProperties : function(row,column,prop){},
- getColumnProperties : function(column,columnElement,prop){},
- getCellProperties : function(row,column,prop) {}
- };
-
-// XXX: Must match the definition in cookie-jar-selector :/
-function Cookie(number,name,value,isDomain,host,rawHost,HttpOnly,path,isSecure,isSession,
- expires,isProtected) {
- this.number = number;
- this.name = name;
- this.value = value;
- this.isDomain = isDomain;
- this.host = host;
- this.rawHost = rawHost;
- this.isHttpOnly = HttpOnly;
- this.path = path;
- this.isSecure = isSecure;
- this.isSession = isSession;
- this.expires = expires;
- this.isProtected = isProtected;
-}
-
-function initDialog() {
- cookiesTree = document.getElementById("cookiesTree");
- prefs =Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
- selector = Components.classes["@torproject.org/cookie-jar-selector;1"]
- .getService(Components.interfaces.nsISupports)
- .wrappedJSObject;
- //init cookie manager
- cookiemanager = Components.classes["@mozilla.org/cookiemanager;1"].getService();
- cookiemanager = cookiemanager.QueryInterface(Components.interfaces.nsICookieManager);
- var enumerator = cookiemanager.enumerator;
- var count = 0;
- getProtectedCookies();
- while (enumerator.hasMoreElements()) {
- var nextCookie = enumerator.getNext();
- if (!nextCookie) break;
- nextCookie = nextCookie.QueryInterface(Components.interfaces.nsICookie);
- var host = nextCookie.host;
- var isProt = checkIfProtected(nextCookie.name, host, nextCookie.path);
- //populate list
- cookies[count] =
- new Cookie(count++, nextCookie.name, nextCookie.value, nextCookie.isDomain, host,
- (host.charAt(0)==".") ? host.substring(1,host.length) : host, nextCookie.isHttpOnly,
- nextCookie.path, nextCookie.isSecure, nextCookie.isSession, nextCookie.expires,
- isProt);
- }
- //apply custom view
- cookiesTreeView.rowCount = cookies.length;
- cookiesTree.treeBoxObject.view = cookiesTreeView;
- document.getElementById('defaultCookieGroup').selectedIndex = prefs.getBoolPref("extensions.torbutton.cookie_auto_protect")? 0 : 1;
-}
-function protectCookie()
-{
- ProtectInTree(cookiesTree, cookiesTreeView,
- cookies, "protectCookie", "unprotectCookie", "removeCookie");
-}
-function unprotectCookie() {
- UnProtectInTree(cookiesTree, cookiesTreeView,
- cookies, "protectCookie", "unprotectCookie", "removeCookie");
-}
-function checkIfProtected(name, host, path)
-{
- for (var i = 0; i < protectedCookies.length; i++)
- {
- var cookie = protectedCookies[i];
- if (cookie.name == name && cookie.host == host && cookie.path == path)
- return true;
- }
- return false;
-}
-function itemSelected() {
- var selections = getTreeSelections(cookiesTree);
- if (selections.length) {
-
-//DY - check if (the last in list) selection is protected/unprotected, set buttons
- if (cookies[selections[(selections.length)-1]].isProtected) {
- document.getElementById("removeCookie").disabled = true;
- document.getElementById("unprotectCookie").disabled = false;
- document.getElementById("protectCookie").disabled = true;
- } else {
- document.getElementById("removeCookie").disabled = false;
- document.getElementById("unprotectCookie").disabled = true;
- document.getElementById("protectCookie").disabled = false;
- }
-
- }
-}
-function acceptDialog() {
-
- FinalizeCookieDeletions();
- var protectedcount = 0;
- var protcookies = [];
- for (var i = 0; i < cookies.length; i++)
- {
- if (cookies[i].isProtected)
- {
- protcookies[protectedcount] = cookies[i];
- protectedcount++;
- }
- }
- selector.protectCookies(protcookies);
- //output protected cookies
- prefs.setBoolPref("extensions.torbutton.cookie_auto_protect",document.getElementById('saveAllCookies').selected);
-}
-function CookieColumnSort(column) {
- lastCookieSortAscending =
- SortTree(cookiesTree, cookiesTreeView, cookies,
- column, lastCookieSortColumn, lastCookieSortAscending);
- lastCookieSortColumn = column;
-}
-function DeleteCookie() {
-//DY - check if any selection is protected
- var selections = getTreeSelections(cookiesTree);
- var protect = false;
- var i;
- for (i=0; i<selections.length; i++) {
- if (cookies[selections[i]].isProtected) {
- protect = true;
- }
- }
- if (!protect && i>0 ) {
- DeleteSelectedItemFromTree(cookiesTree, cookiesTreeView,
- cookies, deletedCookies,
- "removeCookie", "removeAllCookies",
- "protectCookie", "unprotectCookie");
- if (!cookies.length) {
- ;//ClearCookieProperties();
- }
-
- }
-}
-
-function getProtectedCookies()
-{
- var gotCookies = selector.getProtectedCookies("tor");
- if (gotCookies == null)
- return;
- protectedCookies = gotCookies;
-}
-
-//Tree Utils
-
-function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending, updateSelection) {
-
- // remember which item was selected so we can restore it after the sort
- var selections = getTreeSelections(tree);
- var selectedNumber = selections.length ? table[selections[0]].number : -1;
-
- // determine if sort is to be ascending or descending
- var ascending = (column == lastSortColumn) ? !lastSortAscending : true;
-
- // do the sort or re-sort
- var compareFunc = function compare(first, second) {
- if (column=="isProtected") {
- return second[column].toString().localeCompare(first[column].toString());
- } else {
- return first[column].toLowerCase().localeCompare(second[column].toLowerCase());
- }
- }
- table.sort(compareFunc);
- if (!ascending)
- table.reverse();
-
- // restore the selection
- var selectedRow = -1;
- if (selectedNumber>=0 && updateSelection) {
- for (var s=0; s<table.length; s++) {
- if (table[s].number == selectedNumber) {
- // update selection
- // note: we need to deselect before reselecting in order to trigger ...Selected()
- tree.view.selection.select(-1);
- tree.view.selection.select(s);
- selectedRow = s;
- break;
- }
- }
- }
-
- // display the results
- tree.treeBoxObject.invalidate();
- if (selectedRow >= 0) {
- tree.treeBoxObject.ensureRowIsVisible(selectedRow)
- }
-
- return ascending;
-}
-function FinalizeCookieDeletions() {
- for (var c=0; c<deletedCookies.length; c++) {
- cookiemanager.remove(deletedCookies[c].host,
- deletedCookies[c].name,
- deletedCookies[c].path,
- false);
- }
- deletedCookies.length = 0;
-}
-function getTreeSelections(tree) {
- var selections = [];
- var select;
-
- select = tree.view.selection;
- if (select) {
- var count = select.getRangeCount();
- var min = new Object();
- var max = new Object();
- for (var i=0; i<count; i++) {
- select.getRangeAt(i, min, max);
- for (var k=min.value; k<=max.value; k++) {
- if (k != -1) {
- selections[selections.length] = k;
- }
- }
- }
- }
- return selections;
-}
-function ProtectInTree
- (tree, view, table, protButton, unprotButton, removeButton) {
-
- var selections = getTreeSelections(tree);
- for (var s=selections.length-1; s>= 0; s--) {
- var i = selections[s];
- table[i].isProtected = true;
- }
-
- //update tree view
- tree.treeBoxObject.invalidate();
-//DY - Update selections
- tree.treeBoxObject.ensureRowIsVisible(selections[0]);
- // disable/enable buttons
- document.getElementById(unprotButton).disabled = false;
- document.getElementById(protButton).disabled = true;
- document.getElementById(removeButton).disabled = true;
-}
-function UnProtectInTree
- (tree, view, table, protButton, unprotButton, removeButton) {
-
- var selections = getTreeSelections(tree);
- for (var s=selections.length-1; s>= 0; s--) {
- var i = selections[s];
- table[i].isProtected = false;
- }
-
- //update tree view
- tree.treeBoxObject.invalidate();
-//DY - Update selections
- tree.treeBoxObject.ensureRowIsVisible(selections[0]);
- // disable/enable buttons
- document.getElementById(unprotButton).disabled = true;
- document.getElementById(protButton).disabled = false;
- document.getElementById(removeButton).disabled = false;
-}
-function DeleteAllCookies() {
-
- DeleteAllFromTree(cookiesTree, cookiesTreeView,
- cookies, deletedCookies,
- "removeCookie", "removeAllCookies",
- "protectCookie", "unprotectCookie");
-
-}
-function DeleteSelectedItemFromTree
- (tree, view, table, deletedTable, removeButton, removeAllButton, protButton, unprotButton) {
-
- var selections = getTreeSelections(tree);
-
- tree.view.selection.clearSelection();
-
-
- // remove selected items from list (by setting them to null) and place in deleted list
- for (var s=selections.length-1; s>= 0; s--) {
- var i = selections[s];
- deletedTable[deletedTable.length] = table[i];
- table[i] = null;
- }
- // collapse list by removing all the null entries
- for (var j=0; j<table.length; j++) {
- if (table[j] == null) {
- var k = j;
- while ((k < table.length) && (table[k] == null)) {
- k++;
- }
- table.splice(j, k-j);
- view.rowCount -= k - j;
- tree.treeBoxObject.rowCountChanged(j, j - k);
- }
- }
-//DY - update selection and/or buttons
- if (table.length) {
-
-//DY - update selection to previous (first of) selected position or bottom
- var nextSelection = (selections[0] < table.length) ? selections[0] : table.length-1;
-
- tree.view.selection.select(nextSelection);
- tree.treeBoxObject.ensureRowIsVisible(nextSelection);
- if (table[nextSelection].isProtected) {
- document.getElementById(unprotButton).disabled = false;
- document.getElementById(protButton).disabled = true;
- } else {
- document.getElementById(unprotButton).disabled = true;
- document.getElementById(protButton).disabled = false;
- }
- } else {
- // disable buttons
- document.getElementById(removeButton).disabled = true;
- document.getElementById(removeAllButton).disabled = true;
- document.getElementById(unprotButton).disabled = true;
- document.getElementById(protButton).disabled = true;
- }
-}
-function DeleteAllFromTree
- (tree, view, table, deletedTable, removeButton, removeAllButton, protButton, unprotButton) {
-
- // remove items from table and place in deleted table
- for (var i=0; i<table.length; i++) {
-//DY - only if unprotected
- if (!table[i].isProtected) {
- deletedTable[deletedTable.length] = table[i];
- table[i] = null;
- }
- }
-
- tree.view.selection.clearSelection();
-
-//DY - fix up tree
- // collapse list by removing all the null entries
- for (var j=0; j<table.length; j++) {
- if (table[j] == null) {
- var k = j;
- while ((k < table.length) && (table[k] == null)) {
- k++;
- }
- table.splice(j, k-j);
- view.rowCount -= k - j;
- tree.treeBoxObject.rowCountChanged(j, j - k);
- }
- }
- // update selection and/or buttons
- if (table.length) {
- // update selection to top
- tree.view.selection.select(0);
- tree.treeBoxObject.ensureRowIsVisible(0);
- //if it exists is must already be protected
- document.getElementById(unprotButton).disabled = false;
- document.getElementById(protButton).disabled = true;
- } else {
- // disable all buttons
- document.getElementById(removeButton).disabled = true;
- document.getElementById(removeAllButton).disabled = true;
- document.getElementById(unprotButton).disabled = true;
- document.getElementById(protButton).disabled = true;
- }
-}
diff --git a/src/chrome/content/torcookiedialog.xul b/src/chrome/content/torcookiedialog.xul
deleted file mode 100644
index 68a7cafe..00000000
--- a/src/chrome/content/torcookiedialog.xul
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://torbutton/skin/torbutton.css" type="text/css"?>
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<!DOCTYPE overlay SYSTEM "chrome://torbutton/locale/torbutton.dtd">
-
-<dialog id="TorCookieDialog"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- title="&torbutton.cookiedialog.title;"
- buttons="accept,cancel"
- style="width: 30em;"
- onload="initDialog();"
- ondialogaccept="acceptDialog();"
- persist="screenX screenY width height">
- <script src="chrome://torbutton/content/torbutton.js" type="application/x-javascript"/>
- <script src="chrome://torbutton/content/torcookie.js" type="application/x-javascript"/>
- <stringbundleset id="torbutton-stringbundleset">
- <stringbundle id="torbutton-bundle" src="chrome://torbutton/locale/torbutton.properties"/>
- </stringbundleset>
-
- <label value=""/>
- <separator class="thin"/>
- <vbox flex="1">
- <tree id="cookiesTree" flex="1" style="height: 10em;"
- onkeypress="return;//do this later"
- onselect="itemSelected();"
- hidecolumnpicker="true">
- <treecols>
- <treecol id="lockCol" label="&torbutton.cookiedialog.lockCol;" flex="1"
- onclick="CookieColumnSort('isProtected', true);" persist="width"/>
- <splitter class="tree-splitter"/>
- <treecol id="domainCol" label="&torbutton.cookiedialog.domainCol;" flex="2"
- onclick="CookieColumnSort('rawHost', true);" persist="width"/>
- <splitter class="tree-splitter"/>
- <treecol id="nameCol" label="&torbutton.cookiedialog.nameCol;" flex="1"
- onclick="CookieColumnSort('name', true);" persist="width"/>
- <treecol id="pathCol" label="&torbutton.cookiedialog.pathCol;" flex="1"
- onclick="CookieColumnSort('path', true);" persist="width"/>
-
- </treecols>
- <treechildren/>
- </tree>
- </vbox>
- <groupbox>
- <hbox>
- <vbox>
- <button id="protectCookie" disabled="true"
- label="&torbutton.cookiedialog.protectCookie;"
- oncommand="protectCookie();"/>
- <button id="removeCookie" disabled="true"
- label="&torbutton.cookiedialog.removeCookie;"
- oncommand="DeleteCookie();"/>
- </vbox>
- <vbox>
- <button id="unprotectCookie" disabled="true"
- label="&torbutton.cookiedialog.unprotectCookie;"
- oncommand="unprotectCookie();"/>
- <button id="removeAllCookies"
- label="&torbutton.cookiedialog.removeAllBut;"
- oncommand="DeleteAllCookies();"/>
- </vbox>
- </hbox>
- <hbox>
- <radiogroup id="defaultCookieGroup">
- <radio id="saveAllCookies" label="&torbutton.cookiedialog.saveAllCookies;" />
- <radio id="donnotsaveCookies" label="&torbutton.cookiedialog.doNotSaveAllCookies;" />
- </radiogroup>
- </hbox>
- </groupbox>
-
-</dialog>
-
1
0
[tor-launcher/master] Bug 31300: Modify Tor Launcher so it is compatible with ESR68
by gk@torproject.org 07 Aug '19
by gk@torproject.org 07 Aug '19
07 Aug '19
commit 1af54380f289426fea9dfa24c4fd6cf171046723
Author: Kathy Brade <brade(a)pearlcrescent.com>
Date: Fri Aug 2 10:23:31 2019 -0400
Bug 31300: Modify Tor Launcher so it is compatible with ESR68
Replace some wizard and dialog "on" attributes with event handlers.
Replace the XUL listbox element (which was removed by Mozilla) with
richlistbox.
Replace the XUL progressmeter element (which was removed by Mozilla) with
an HTML progress element.
Define our own CSS rules for groupbox elements (Mozilla removed the
built-in styles).
Fix some minor CSS incompatibilities.
---
src/chrome/content/localePicker.xul | 6 +-
src/chrome/content/network-settings-shared.js | 8 +--
src/chrome/content/network-settings-wizard.xul | 24 +++-----
src/chrome/content/network-settings.js | 76 +++++++++++++++++++++++---
src/chrome/content/network-settings.xul | 3 -
src/chrome/skin/network-settings.css | 14 +++--
6 files changed, 92 insertions(+), 39 deletions(-)
diff --git a/src/chrome/content/localePicker.xul b/src/chrome/content/localePicker.xul
index 1d0987c..152b54c 100644
--- a/src/chrome/content/localePicker.xul
+++ b/src/chrome/content/localePicker.xul
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- - Copyright (c) 2017, The Tor Project, Inc.
+ - Copyright (c) 2019, The Tor Project, Inc.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
-->
@@ -16,8 +16,6 @@
title="&torlauncher.localePicker.title;"
windowtype="TorLauncher:LocalePicker"
persist="screenX screenY"
- onwizardfinish="return setLocale();"
- onwizardcancel="return onCancel();"
onload="initLocaleDialog();">
<script type="application/x-javascript"
@@ -31,7 +29,7 @@
<vbox>
<label class="question">&torlauncher.localePicker.prompt;</label>
<separator/>
- <listbox id="localeList" ondblclick="onLocaleListDoubleClick()"/>
+ <richlistbox id="localeList" ondblclick="onLocaleListDoubleClick()"/>
</vbox>
</wizardpage>
diff --git a/src/chrome/content/network-settings-shared.js b/src/chrome/content/network-settings-shared.js
index 206872b..f1bdb91 100644
--- a/src/chrome/content/network-settings-shared.js
+++ b/src/chrome/content/network-settings-shared.js
@@ -20,7 +20,7 @@ var proxySettings = `
<rows>
<row align="center">
<label value="&torsettings.useProxy.type;" control="proxyType"
- style="text-align:right"/>
+ class="rightAlign"/>
<hbox align="center">
<menulist id="proxyType" sizetopopup="always"
placeholder="&torsettings.useProxy.type.placeholder;"
@@ -38,7 +38,7 @@ var proxySettings = `
</row>
<row align="center">
<label value="&torsettings.useProxy.address;" control="proxyAddr"
- style="text-align:right"/>
+ class="rightAlign"/>
<hbox align="center">
<textbox id="proxyAddr" size="20" flex="1"
placeholder="&torsettings.useProxy.address.placeholder;"/>
@@ -50,7 +50,7 @@ var proxySettings = `
<row align="center">
<label id="proxyUsernameLabel"
value="&torsettings.useProxy.username;"
- control="proxyUsername" style="text-align:right"/>
+ control="proxyUsername" class="rightAlign"/>
<hbox align="center">
<textbox id="proxyUsername" size="14" flex="1"
placeholder="&torsettings.optional;"/>
@@ -146,7 +146,7 @@ var progressContent = `
<vbox flex="1">
<description id="progressPleaseWait"
hidden="true">&torprogress.pleaseWait;</description>
- <progressmeter id="progressMeter" mode="determined" value="0"/>
+ <html:progress id="progressMeter" value="0" max="100"/>
<description id="progressDesc" errorElemId="message"/>
<label id="progressReconfigureLabel" hidden="true"
value="&torsettings.reconfigTor;"/>
diff --git a/src/chrome/content/network-settings-wizard.xul b/src/chrome/content/network-settings-wizard.xul
index 2eb6d6d..ec48bd0 100644
--- a/src/chrome/content/network-settings-wizard.xul
+++ b/src/chrome/content/network-settings-wizard.xul
@@ -1,4 +1,3 @@
-<?xml version="1.0"?>
<!--
- Copyright (c) 2019, The Tor Project, Inc.
- See LICENSE for licensing information.
@@ -17,15 +16,13 @@
windowtype="TorLauncher:NetworkSettings"
persist="screenX screenY"
buttonlabelextra2="&torsettings.copyLog;"
- onwizardfinish="return onWizardFinish();"
- onwizardcancel="return onCancel();"
onload="initDialog();"
onunload="deinitDialog();">
<script type="application/x-javascript"
src="chrome://torlauncher/content/network-settings.js"/>
- <wizardpage pageid="first" next="configureSettings" onextra2="onCopyLog();"
+ <wizardpage pageid="first" next="configureSettings"
torShowNavButtons="false">
<hbox class="tbb-header" pack="center">
<image class="tbb-logo"/>
@@ -44,7 +41,7 @@
</vbox>
</wizardpage>
- <wizardpage pageid="configureSettings" onextra2="onCopyLog();"
+ <wizardpage pageid="configureSettings"
windowtitle="&torsettings.wizard.title.configure;"
torShowNavButtons="true">
<stack flex="1">
@@ -63,11 +60,9 @@
</stack>
</wizardpage>
- <wizardpage pageid="progress" onextra2="onCopyLog();"
+ <wizardpage pageid="progress"
windowtitle="&torsettings.wizard.title.connecting;"
- torShowNavButtons="false"
- onpageshow="onShowProgressPanel();"
- onpagehide="return resetProgressNavButtons();">
+ torShowNavButtons="false">
<vbox id="progressContent"/>
</wizardpage>
@@ -86,12 +81,12 @@
</wizardpage>
<wizardpage pageid="restartPanel" class="messagePanel" next="notUsed"
- pack="center" torShowNavButtons="false" onextra2="onCopyLog();">
+ pack="center" torShowNavButtons="false">
<vbox id="restartContent"/>
</wizardpage>
<wizardpage pageid="errorPanel" class="messagePanel" next="notUsed"
- torShowNavButtons="false" onextra2="onCopyLog();">
+ torShowNavButtons="false">
<spring flex="1"/>
<hbox pack="center">
<description errorElemId="message" flex="1"/>
@@ -104,8 +99,8 @@
<spring flex="1"/>
</wizardpage>
- <wizardpage pageid="discardSettings" next="notUsed" torShowNavButtons="false"
- onextra2="onCopyLog();">
+ <wizardpage pageid="discardSettings" next="notUsed"
+ torShowNavButtons="false">
<hbox class="tbb-header" pack="center">
<image class="tbb-logo"/>
</hbox>
@@ -123,8 +118,7 @@
<spring flex="1"/>
</wizardpage>
- <wizardpage class="help" pageid="helpPanel" next="notUsed"
- onpageadvanced="closeHelp(); return false;">
+ <wizardpage class="help" pageid="helpPanel" next="notUsed">
<vbox id="bridgeHelpContent"/>
<vbox id="proxyHelpContent"/>
</wizardpage>
diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js
index 85dade2..a4f2866 100644
--- a/src/chrome/content/network-settings.js
+++ b/src/chrome/content/network-settings.js
@@ -157,6 +157,51 @@ function initDialogCommon()
.getService(Ci.nsIEnvironment);
if (env.exists("TOR_HIDE_BROWSER_LOGO"))
wizardElem.setAttribute("tor_hide_browser_logo", true);
+
+ // Add wizard event listeners.
+ document.addEventListener("wizardcancel", (aEvent) => {
+ if (!onCancel())
+ aEvent.preventDefault();
+ });
+
+ document.addEventListener("pageadvanced", (aEvent) => {
+ if ("helpPanel" == wizardElem.currentPage.pageid)
+ {
+ closeHelp();
+ aEvent.preventDefault();
+ }
+ });
+
+ document.addEventListener("pageshow", (aEvent) => {
+ if (kWizardProgressPageID == wizardElem.currentPage.pageid)
+ onShowProgressPanel();
+ });
+
+ document.addEventListener("pagehide", (aEvent) => {
+ if (kWizardProgressPageID == wizardElem.currentPage.pageid)
+ resetProgressNavButtons();
+ });
+
+ document.addEventListener("extra2", (aEvent) => {
+ onCopyLog();
+ });
+ }
+ else
+ {
+ // Add network settings dialog event listeners.
+ document.addEventListener("dialogaccept", (aEvent) => {
+ if (!onNetworkSettingsFinish())
+ aEvent.preventDefault();
+ });
+
+ document.addEventListener("dialogcancel", (aEvent) => {
+ if (!onCancel())
+ aEvent.preventDefault();
+ });
+
+ document.addEventListener("dialogextra2", (aEvent) => {
+ onCopyLog();
+ });
}
}
@@ -239,6 +284,12 @@ function initDialog()
let haveWizard = (wizardElem != null);
if (haveWizard)
{
+ // Add wizardfinish event handler.
+ document.addEventListener("wizardfinish", (aEvent) => {
+ if (!onWizardFinish())
+ aEvent.preventDefault();
+ });
+
// Relabel the accept button to be "Connect"
let okBtn = document.documentElement.getButton("accept");
if (okBtn)
@@ -316,6 +367,11 @@ function initLocaleDialog()
{
initDialogCommon();
+ // Add wizardfinish event handler.
+ document.addEventListener("wizardfinish", (aEvent) => {
+ setLocale();
+ });
+
// Replace the finish button's label ("Done") with the next button's
// label ("Next" or "Continue").
let nextBtn = document.documentElement.getButton("next");
@@ -324,7 +380,8 @@ function initLocaleDialog()
doneBtn.label = nextBtn.label;
let { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm");
- AddonManager.getAddonsByTypes(["locale"], function(aLangPackAddons)
+ let addonsPromise = AddonManager.getAddonsByTypes(["locale"]);
+ addonsPromise.then(aLangPackAddons =>
{
populateLocaleList(aLangPackAddons);
resizeDialogToFitContent();
@@ -421,13 +478,15 @@ function populateLocaleList(aLangPackAddons)
langInfo.splice(0, 0,
{ langCode: code, langName: name, isSelected: isSelected });
- // Populate the XUL listbox.
+ // Populate the XUL richlistbox.
let localeList = document.getElementById(kLocaleList);
for (let infoObj of langInfo)
{
- let listItem = document.createElement("listitem");
+ let listItem = document.createElement("richlistitem");
listItem.setAttribute("value", infoObj.langCode);
- listItem.setAttribute("label", infoObj.langName);
+ let label = document.createElement("label");
+ label.value = infoObj.langName;
+ listItem.appendChild(label);
localeList.appendChild(listItem);
if (infoObj.isSelected)
localeList.selectedItem = listItem;
@@ -807,7 +866,6 @@ function resetProgressNavButtons()
restoreButtonLabel("finish");
showOrHideButton("cancel", true, false);
- return true;
}
@@ -905,7 +963,7 @@ function updateBootstrapProgress(aStatusObj)
let meter = document.getElementById("progressMeter");
if (meter)
{
- meter.value = percentComplete;
+ meter.setAttribute("value", percentComplete);
showProgressMeterIfNoError();
}
@@ -1968,7 +2026,7 @@ function showProgressPanel()
let meter = document.getElementById("progressMeter");
if (meter)
{
- meter.value = 0;
+ meter.setAttribute("value", 0);
meter.style.visibility = "hidden";
}
@@ -2428,7 +2486,7 @@ function setElemValue(aID, aValue)
}
// fallthru
case "menulist":
- case "listbox":
+ case "richlistbox":
case "label":
elem.value = (val) ? val : "";
break;
@@ -2482,7 +2540,7 @@ function getElemValue(aID, aDefaultValue)
break;
case "textbox":
case "menulist":
- case "listbox":
+ case "richlistbox":
rv = elem.value;
break;
}
diff --git a/src/chrome/content/network-settings.xul b/src/chrome/content/network-settings.xul
index 2ba0741..6a8fac4 100644
--- a/src/chrome/content/network-settings.xul
+++ b/src/chrome/content/network-settings.xul
@@ -18,9 +18,6 @@
persist="screenX screenY"
buttons="accept,cancel,extra2"
buttonlabelextra2="&torsettings.copyLog;"
- ondialogaccept="return onNetworkSettingsFinish();"
- ondialogcancel="return onCancel();"
- ondialogextra2="onCopyLog();"
onload="initDialog();"
onunload="deinitDialog();">
diff --git a/src/chrome/skin/network-settings.css b/src/chrome/skin/network-settings.css
index 40ca0f0..9fed4f2 100644
--- a/src/chrome/skin/network-settings.css
+++ b/src/chrome/skin/network-settings.css
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, The Tor Project, Inc.
+ * Copyright (c) 2019, The Tor Project, Inc.
* See LICENSE for licensing information.
*
* vim: set sw=2 sts=2 ts=8 et syntax=css:
@@ -47,8 +47,14 @@ wizard label {
margin: 0px;
}
-wizard radiogroup {
- margin: 5px 0px 8px 25px;
+.rightAlign {
+ text-align: right;
+}
+
+groupbox {
+ margin-left: 16px;
+ padding: 8px;
+ border: 1px solid GrayText;
}
.tbb-header groupbox {
@@ -57,7 +63,7 @@ wizard radiogroup {
margin-bottom: 0px;
}
-.firstResponses label {
+.firstResponses > label {
text-align: center;
margin-top: 1.2em;
}
1
0
[tor-launcher/master] Bug 29197: Remove use of overlays (ESR68 compatibility).
by gk@torproject.org 07 Aug '19
by gk@torproject.org 07 Aug '19
07 Aug '19
commit 8bc4a8869936cfc782d1f4c749f7608ead6ddf18
Author: Kathy Brade <brade(a)pearlcrescent.com>
Date: Tue Jul 30 16:34:27 2019 -0400
Bug 29197: Remove use of overlays (ESR68 compatibility).
Use the window.MozXULElement.parseXULToFragment() function to
parse shared XUL.
---
src/chrome/content/localePicker.xul | 4 +-
...ings-overlay.xul => network-settings-shared.js} | 48 +++++++++++-----------
src/chrome/content/network-settings-wizard.xul | 10 ++---
src/chrome/content/network-settings.js | 36 ++++++++++++++++
src/chrome/content/network-settings.xul | 18 ++++----
5 files changed, 76 insertions(+), 40 deletions(-)
diff --git a/src/chrome/content/localePicker.xul b/src/chrome/content/localePicker.xul
index 6030468..1d0987c 100644
--- a/src/chrome/content/localePicker.xul
+++ b/src/chrome/content/localePicker.xul
@@ -9,9 +9,7 @@
<?xml-stylesheet href="chrome://torlauncher/skin/network-settings.css"
type="text/css"?>
-<!DOCTYPE overlay SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
-
-<?xul-overlay href="chrome://torlauncher/content/network-settings-overlay.xul"?>
+<!DOCTYPE wizard SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
<wizard id="TorLauncherLocalePicker"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
diff --git a/src/chrome/content/network-settings-overlay.xul b/src/chrome/content/network-settings-shared.js
similarity index 91%
rename from src/chrome/content/network-settings-overlay.xul
rename to src/chrome/content/network-settings-shared.js
index 35b9fc7..206872b 100644
--- a/src/chrome/content/network-settings-overlay.xul
+++ b/src/chrome/content/network-settings-shared.js
@@ -1,16 +1,9 @@
-<?xml version="1.0"?>
-<!--
- - Copyright (c) 2018, The Tor Project, Inc.
- - See LICENSE for licensing information.
- - vim: set sw=2 sts=2 ts=8 et syntax=xml:
- -->
-
-<!DOCTYPE overlay SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
-
-<overlay id="TorNetworkSettingsOverlay"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- xmlns:html="http://www.w3.org/1999/xhtml">
+// Copyright (c) 2019, The Tor Project, Inc.
+// See LICENSE for licensing information.
+//
+// vim: set sw=2 sts=2 ts=8 et syntax=javascript:
+var proxySettings = `
<vbox id="proxySettings">
<hbox align="center">
<checkbox id="useProxy" groupboxID="proxySpecificSettings"
@@ -73,20 +66,16 @@
</grid>
</groupbox>
</vbox>
+`;
- <vbox id="proxyHelpContent">
+var proxyHelpContent = `
+ <vbox id="proxyHelpContent" hidden="true">
<hbox align="middle"><label>&torsettings.proxyHelpTitle;</label></hbox>
<description>&torsettings.proxyHelp1;</description>
</vbox>
+`;
- <groupbox id="firewallSpecificSettings">
- <hbox align="center">
- <label value="&torsettings.firewall.allowedPorts;"
- control="firewallAllowedPorts"/>
- <textbox id="firewallAllowedPorts" value="80,443"/>
- </hbox>
- </groupbox>
-
+var bridgeSettings = `
<vbox id="bridgeSettings">
<checkbox id="useBridges" groupboxID="bridgeSpecificSettings"
label="&torsettings.useBridges.checkbox;"
@@ -139,13 +128,17 @@
</vbox>
</groupbox>
</vbox>
+`;
- <vbox id="bridgeHelpContent">
+var bridgeHelpContent = `
+ <vbox id="bridgeHelpContent" hidden="true">
<hbox align="middle"><label>&torsettings.bridgeHelpTitle;</label></hbox>
<description>&torsettings.bridgeHelp1;</description>
<description>&torsettings.bridgeHelp2;</description>
</vbox>
+`;
+var progressContent = `
<vbox id="progressContent">
<hbox class="tbb-header" pack="center">
<image class="tbb-logo"/>
@@ -159,7 +152,9 @@
value="&torsettings.reconfigTor;"/>
</vbox>
</vbox>
+`;
+var restartContent = `
<vbox id="restartContent">
<hbox pack="center">
<description id="restartPanelMessage" flex="1"/>
@@ -170,7 +165,9 @@
oncommand="onRestartTor()"/>
</hbox>
</vbox>
+`;
+var bridgeDBRequestOverlayContent = `
<vbox id="bridgeDBRequestOverlayContent" align="center">
<vbox>
<label id="bridgeDBPrompt"/>
@@ -200,7 +197,9 @@
</hbox>
</vbox>
</vbox>
+`;
+var errorOverlayContent = `
<vbox id="errorOverlayContent">
<hbox pack="center">
<description errorElemId="message" flex="1"/>
@@ -211,10 +210,11 @@
oncommand="onDismissErrorOverlay()"/>
</hbox>
</vbox>
+`;
+var copyLogFeedbackPanel = `
<panel id="copyLogFeedbackPanel" type="arrow" fade="slow"
onclick="closeCopyLogFeedbackPanel()">
<description flex="1"/>
</panel>
-</overlay>
-
+`;
diff --git a/src/chrome/content/network-settings-wizard.xul b/src/chrome/content/network-settings-wizard.xul
index 00145a8..2eb6d6d 100644
--- a/src/chrome/content/network-settings-wizard.xul
+++ b/src/chrome/content/network-settings-wizard.xul
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- - Copyright (c) 2018, The Tor Project, Inc.
+ - Copyright (c) 2019, The Tor Project, Inc.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
-->
@@ -9,9 +9,7 @@
<?xml-stylesheet href="chrome://torlauncher/skin/network-settings.css"
type="text/css"?>
-<!DOCTYPE overlay SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
-
-<?xul-overlay href="chrome://torlauncher/content/network-settings-overlay.xul"?>
+<!DOCTYPE wizard SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
<wizard id="TorNetworkSettings"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
@@ -127,8 +125,8 @@
<wizardpage class="help" pageid="helpPanel" next="notUsed"
onpageadvanced="closeHelp(); return false;">
- <vbox id="bridgeHelpContent" hidden="true"/>
- <vbox id="proxyHelpContent" hidden="true"/>
+ <vbox id="bridgeHelpContent"/>
+ <vbox id="proxyHelpContent"/>
</wizardpage>
<hbox pack="start">
diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js
index b39a194..85dade2 100644
--- a/src/chrome/content/network-settings.js
+++ b/src/chrome/content/network-settings.js
@@ -10,6 +10,7 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
+Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TorLauncherUtil",
"resource://torlauncher/modules/tl-util.jsm");
@@ -116,6 +117,8 @@ var gBridgeDBRequestEventListeners = [];
function initDialogCommon()
{
+ loadSharedXUL();
+
gObsService = Cc["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
@@ -158,6 +161,39 @@ function initDialogCommon()
}
+function loadSharedXUL()
+{
+ let ctxt = {};
+ Services.scriptloader.loadSubScript(
+ "chrome://torlauncher/content/network-settings-shared.js", ctxt);
+
+ let elementIDs =
+ [
+ "proxySettings",
+ "proxyHelpContent",
+ "bridgeSettings",
+ "bridgeHelpContent",
+ "progressContent",
+ "restartContent",
+ "bridgeDBRequestOverlayContent",
+ "errorOverlayContent",
+ "copyLogFeedbackPanel",
+ ];
+
+ let entityURLs = ["chrome://torlauncher/locale/network-settings.dtd"];
+ elementIDs.forEach(aID =>
+ {
+ let node = document.getElementById(aID);
+ if (node)
+ {
+ let xulStr = ctxt[aID];
+ let frag = window.MozXULElement.parseXULToFragment(xulStr, entityURLs);
+ node.parentNode.replaceChild(frag, node);
+ }
+ });
+}
+
+
function resizeDialogToFitContent()
{
// Resize this window to fit content. sizeToContent() alone will not do
diff --git a/src/chrome/content/network-settings.xul b/src/chrome/content/network-settings.xul
index 6f95183..2ba0741 100644
--- a/src/chrome/content/network-settings.xul
+++ b/src/chrome/content/network-settings.xul
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- - Copyright (c) 2018, The Tor Project, Inc.
+ - Copyright (c) 2019, The Tor Project, Inc.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
-->
@@ -9,9 +9,7 @@
<?xml-stylesheet href="chrome://torlauncher/skin/network-settings.css"
type="text/css"?>
-<!DOCTYPE overlay SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
-
-<?xul-overlay href="chrome://torlauncher/content/network-settings-overlay.xul"?>
+<!DOCTYPE dialog SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
<dialog id="TorNetworkSettings"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
@@ -41,7 +39,13 @@
groupboxID="firewallSpecificSettings"
label="&torsettings.firewall.checkbox;"
oncommand="toggleElemUI(this)"/>
- <groupbox id="firewallSpecificSettings"/>
+ <groupbox id="firewallSpecificSettings">
+ <hbox align="center">
+ <label value="&torsettings.firewall.allowedPorts;"
+ control="firewallAllowedPorts"/>
+ <textbox id="firewallAllowedPorts" value="80,443"/>
+ </hbox>
+ </groupbox>
</vbox>
</vbox>
@@ -60,8 +64,8 @@
</vbox>
<vbox id="helpPanel" class="help">
- <vbox id="bridgeHelpContent" hidden="true"/>
- <vbox id="proxyHelpContent" hidden="true"/>
+ <vbox id="bridgeHelpContent"/>
+ <vbox id="proxyHelpContent"/>
</vbox>
<vbox id="restartPanel" class="messagePanel" pack="center">
1
0
[tor-browser/tor-browser-60.8.0esr-9.0-1] Bug 31344: Actually register SecurityLevelPreference's 'unload' callback in privacy.js
by gk@torproject.org 07 Aug '19
by gk@torproject.org 07 Aug '19
07 Aug '19
commit d48c3fa6ace654296c78210e370838bcaaf4078c
Author: Richard Pospesel <richard(a)torproject.org>
Date: Mon Aug 5 15:44:15 2019 -0700
Bug 31344: Actually register SecurityLevelPreference's 'unload' callback in privacy.js
---
browser/components/preferences/in-content/privacy.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/browser/components/preferences/in-content/privacy.js b/browser/components/preferences/in-content/privacy.js
index d2229d136261..3997f22d63ad 100644
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -161,6 +161,7 @@ var gPrivacyPane = {
window.removeEventListener("unload", unload);
SecurityLevelPreferences.uninit();
};
+ window.addEventListener("unload", unload);
},
/**
1
0
[tor-browser-build/master] Bug 30736: Install yasm from wheezy-backports
by gk@torproject.org 07 Aug '19
by gk@torproject.org 07 Aug '19
07 Aug '19
commit 0a8ab5b289753683cf9a5bfae3bd6e24b463eeb1
Author: Nicolas Vigier <boklm(a)torproject.org>
Date: Fri Aug 2 06:01:54 2019 +0200
Bug 30736: Install yasm from wheezy-backports
---
projects/firefox/config | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/projects/firefox/config b/projects/firefox/config
index 0b340f5..14be6ef 100644
--- a/projects/firefox/config
+++ b/projects/firefox/config
@@ -58,6 +58,15 @@ targets:
arch_deps:
- openjdk-8-jdk
+ linux:
+ var:
+ post_pkginst: |
+ # Firefox ESR68 needs Yasm >= 1.2.0 which Debian Wheezy ships in backports.
+ echo 'deb http://archive.debian.org/debian/ wheezy-backports main' >> /etc/apt/sources.list
+ export DEBIAN_FRONTEND=noninteractive
+ apt-get update
+ apt-get install -t wheezy-backports -y yasm
+
linux-x86_64:
var:
martools_filename: mar-tools-linux64.zip
1
0
02 Aug '19
commit 2a34a082c587eb21e5880406a5fd6ac8c8425234
Author: Georg Koppen <gk(a)torproject.org>
Date: Fri May 31 16:50:24 2019 +0000
Bug 30701: Adding node project
---
projects/node/build | 24 ++++++++++++++++++++++++
projects/node/config | 17 +++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/projects/node/build b/projects/node/build
new file mode 100644
index 0000000..0e6ca04
--- /dev/null
+++ b/projects/node/build
@@ -0,0 +1,24 @@
+#!/bin/bash
+[% c("var/set_default_env") -%]
+[% IF c("var/linux") %]
+ # We need a link to our GCC, otherwise the system cc gets used which points to
+ # /usr/bin/gcc.
+ [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
+ hardened_gcc => 0 }) %]
+ ln -s gcc /var/tmp/dist/gcc/bin/cc
+ tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
+ export PATH="/var/tmp/dist/binutils/bin:$PATH"
+[% END -%]
+distdir=/var/tmp/dist/[% project %]
+tar -xf [% project %]-[% c('version') %].tar.xz
+cd [% project %]-[% c('version') %]
+
+./configure --prefix=$distdir
+make -j[% c("buildconf/num_procs") %]
+make install
+
+cd /var/tmp/dist
+[% c('tar', {
+ tar_src => [ project ],
+ tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
+ }) %]
diff --git a/projects/node/config b/projects/node/config
new file mode 100644
index 0000000..e023380
--- /dev/null
+++ b/projects/node/config
@@ -0,0 +1,17 @@
+# vim: filetype=yaml sw=2
+version: v10.16.0
+filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
+var:
+ container:
+ use_container: 1
+
+input_files:
+ - project: container-image
+ - project: binutils
+ name: binutils
+ enable: '[% c("var/linux") %]'
+ - project: '[% c("var/compiler") %]'
+ name: '[% c("var/compiler") %]'
+ enable: '[% c("var/linux") %]'
+ - URL: 'https://nodejs.org/download/release/[% c("version") %]/node-[% c("version") %].tar.xz'
+ sha256sum: 18e37f891d10ea7fbc8f6410c444c2b1d9cc3cbbb1d35aa9c41f761816956608
1
0
02 Aug '19
commit 460d5ef80d2bb7ebf808574d21ec7fe43dd9dd01
Author: Georg Koppen <gk(a)torproject.org>
Date: Sun Jun 2 20:33:22 2019 +0000
Bug 30734: Add nasm project
---
projects/nasm/build | 24 ++++++++++++++++++++++++
projects/nasm/config | 17 +++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/projects/nasm/build b/projects/nasm/build
new file mode 100644
index 0000000..0e6ca04
--- /dev/null
+++ b/projects/nasm/build
@@ -0,0 +1,24 @@
+#!/bin/bash
+[% c("var/set_default_env") -%]
+[% IF c("var/linux") %]
+ # We need a link to our GCC, otherwise the system cc gets used which points to
+ # /usr/bin/gcc.
+ [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
+ hardened_gcc => 0 }) %]
+ ln -s gcc /var/tmp/dist/gcc/bin/cc
+ tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/binutils') %]
+ export PATH="/var/tmp/dist/binutils/bin:$PATH"
+[% END -%]
+distdir=/var/tmp/dist/[% project %]
+tar -xf [% project %]-[% c('version') %].tar.xz
+cd [% project %]-[% c('version') %]
+
+./configure --prefix=$distdir
+make -j[% c("buildconf/num_procs") %]
+make install
+
+cd /var/tmp/dist
+[% c('tar', {
+ tar_src => [ project ],
+ tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
+ }) %]
diff --git a/projects/nasm/config b/projects/nasm/config
new file mode 100644
index 0000000..ff82004
--- /dev/null
+++ b/projects/nasm/config
@@ -0,0 +1,17 @@
+# vim: filetype=yaml sw=2
+version: 2.14.02
+filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
+var:
+ container:
+ use_container: 1
+
+input_files:
+ - project: container-image
+ - project: binutils
+ name: binutils
+ enable: '[% c("var/linux") %]'
+ - project: '[% c("var/compiler") %]'
+ name: '[% c("var/compiler") %]'
+ enable: '[% c("var/linux") %]'
+ - URL: 'https://www.nasm.us/pub/nasm/releasebuilds/[% c("version") %]/nasm-[% c("version") %].tar.xz'
+ sha256sum: e24ade3e928f7253aa8c14aa44726d1edf3f98643f87c9d72ec1df44b26be8f5
1
0
[tor-browser/tor-browser-60.8.0esr-9.0-1] Bug 31251: Security Level button UI polish
by gk@torproject.org 01 Aug '19
by gk@torproject.org 01 Aug '19
01 Aug '19
commit 0bed1d181d0839f058e311c01dbdb263a96270fd
Author: Richard Pospesel <richard(a)torproject.org>
Date: Tue Jul 30 11:32:31 2019 -0700
Bug 31251: Security Level button UI polish
Changed the anchor to toolbarbutton's anonymous child toolbarbutton-icon
xul:image element so that the security level panel has the same vertical
alignment as other built-in toolbar buttons. Also needed to add the
badged-button class to our toolbar button for this to align properly.
Now setting and deleting the "open" attribute from the toolbarbutton
element so that it maintains the "pushed" style while the security level
panel is open.
Changed the toolbarbutton's oncommand callback to onmousedown to match
the behaviour of firefox's other toolbarbuttons. Security level panel
now opens on mouse press rather than on mouse press and release.
Slightly re-arranged the ordering of the SecurityLevelPanel object's
method definitions so that callbacks appear in a contiguous block to
better match the other objects defined in securityLevel.js
Removed unnecessary async modifier from
SecurityLevelPanel.openAdvancedSecuritySettings().
Fixed a few typos, improved comments, and removed trailing whitespace.
---
.../securitylevel/content/securityLevel.js | 92 ++++++++++++++++------
.../content/securityLevelButton.inc.xul | 4 +-
.../content/securityLevelPanel.inc.xul | 5 +-
3 files changed, 73 insertions(+), 28 deletions(-)
diff --git a/browser/components/securitylevel/content/securityLevel.js b/browser/components/securitylevel/content/securityLevel.js
index e37f2d49175b..25f6423bc6d3 100644
--- a/browser/components/securitylevel/content/securityLevel.js
+++ b/browser/components/securitylevel/content/securityLevel.js
@@ -124,7 +124,7 @@ const SecurityLevelPrefs = {
set securityCustom(val) {
Services.prefs.setBoolPref(this.security_custom_pref, val);
},
-};
+}; /* Security Level Prefs */
/*
Security Level Button Code
@@ -134,6 +134,8 @@ const SecurityLevelPrefs = {
const SecurityLevelButton = {
_securityPrefsBranch : null,
+ _button : null,
+ _anchor : null,
_populateXUL : function(securityLevelButton) {
if (securityLevelButton != null) {
@@ -164,11 +166,38 @@ const SecurityLevelButton = {
}
},
+ get button() {
+ if (this._button) {
+ return this._button;
+ }
+
+ let button = document.getElementById("security-level-button");
+ if (!button) {
+ return null;
+ }
+
+ return this._button = button;
+ },
+
+ get anchor() {
+ if (this._anchor) {
+ return this._anchor;
+ }
+
+ let anchor = document.getAnonymousElementByAttribute(this.button, "class",
+ "toolbarbutton-icon");
+ if (!anchor) {
+ return null;
+ }
+
+ anchor.setAttribute("consumeanchor", SecurityLevelButton.button.id);
+ return this._anchor = anchor;
+ },
+
init : function() {
// set the initial class based off of the current pref
- let button = document.getElementById("security-level-button");
- this._populateXUL(button);
- this._configUIFromPrefs(button);
+ this._populateXUL(this.button);
+ this._configUIFromPrefs(this.button);
this._securityPrefsBranch = Services.prefs.getBranch("extensions.torbutton.");
this._securityPrefsBranch.addObserver("", this, false);
@@ -191,13 +220,13 @@ const SecurityLevelButton = {
switch(topic) {
case "nsPref:changed":
if (data == "security_slider") {
- this._configUIFromPrefs(document.getElementById("security-level-button"));
+ this._configUIFromPrefs(this.button);
}
break;
}
},
- // callbacks for entering the 'Customize Firefox' screen to set icon
+ // callback for entering the 'Customize Firefox' screen to set icon
onCustomizeStart : function(window) {
let navigatorToolbox = document.getElementById("navigator-toolbox");
let button = navigatorToolbox.palette.querySelector("#security-level-button");
@@ -210,14 +239,20 @@ const SecurityLevelButton = {
if (aNode.id == "security-level-button" && !aWasRemoval) {
this._populateXUL(aNode);
this._configUIFromPrefs(aNode);
+ // clear out our cached elements as they seem to be recreated when the UI is customized
+ delete this._button;
+ delete this._anchor;
}
},
// when toolbar button is pressed
- onCommand : function(anchor, event) {
- SecurityLevelPanel.show(anchor);
+ onCommand : function(event) {
+ // we need to set this attribute for the button to be shaded correctly to look like it is pressed
+ // while the security level panel is open
+ this.button.setAttribute("open", "true");
+ SecurityLevelPanel.show(event);
},
-};
+}; /* Security Level Button */
/*
Security Level Panel Code
@@ -305,19 +340,16 @@ const SecurityLevelPanel = {
this._securityPrefsBranch = null;
},
- show : function(anchor) {
+ show : function() {
// we have to defer this until after the browser has finished init'ing before
// we can populate the panel
if (!this._populated) {
this._populateXUL();
}
- // save off anchor in case we want to show from our own code
- this._anchor = anchor;
-
let panel = document.getElementById("securityLevel-panel");
panel.hidden = false;
- PanelMultiView.openPopup(panel, anchor, "bottomcenter topright",
+ PanelMultiView.openPopup(panel, SecurityLevelButton.anchor, "bottomcenter topright",
0, 0, false, null).catch(Cu.reportError);
},
@@ -326,7 +358,19 @@ const SecurityLevelPanel = {
PanelMultiView.hidePopup(panel);
},
- // when prefs change
+ restoreDefaults : function() {
+ SecurityLevelPrefs.securityCustom = false;
+ // hide and reshow so that layout re-renders properly
+ this.hide();
+ this.show(this._anchor);
+ },
+
+ openAdvancedSecuritySettings : function() {
+ openPreferences("privacy-securitylevel");
+ this.hide();
+ },
+
+ // callback when prefs change
observe : function(subject, topic, data) {
switch(topic) {
case "nsPref:changed":
@@ -337,18 +381,16 @@ const SecurityLevelPanel = {
}
},
- restoreDefaults : function() {
- SecurityLevelPrefs.securityCustom = false;
- // hide and reshow so that layout re-renders properly
- this.hide();
- this.show(this._anchor);
+ // callback when the panel is displayed
+ onPopupShown : function(event) {
+ SecurityLevelButton.button.setAttribute("open", "true");
},
- openAdvancedSecuritySettings : async function() {
- openPreferences("privacy-securitylevel");
- this.hide();
+ // callback when the panel is hidden
+ onPopupHidden : function(event) {
+ SecurityLevelButton.button.removeAttribute("open");
}
-};
+}; /* Security Level Panel */
/*
Security Level Preferences Code
@@ -507,7 +549,7 @@ const SecurityLevelPreferences =
restoreDefaults : function() {
SecurityLevelPrefs.securityCustom = false;
},
-};
+}; /* Security Level Prefereces */
Object.defineProperty(this, "SecurityLevelButton", {
value: SecurityLevelButton,
diff --git a/browser/components/securitylevel/content/securityLevelButton.inc.xul b/browser/components/securitylevel/content/securityLevelButton.inc.xul
index 4ad26f4142bd..579a55f46d4a 100644
--- a/browser/components/securitylevel/content/securityLevelButton.inc.xul
+++ b/browser/components/securitylevel/content/securityLevelButton.inc.xul
@@ -1,5 +1,5 @@
-<toolbarbutton id="security-level-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
+<toolbarbutton id="security-level-button" class="toolbarbutton-1 chromeclass-toolbar-additional badged-button"
removable="true"
- oncommand="SecurityLevelButton.onCommand(this, event);"
+ onmousedown="SecurityLevelButton.onCommand();"
closemenu="none"
cui-areatype="toolbar"/>
diff --git a/browser/components/securitylevel/content/securityLevelPanel.inc.xul b/browser/components/securitylevel/content/securityLevelPanel.inc.xul
index 532e8dd98b32..6a00e811a6ac 100644
--- a/browser/components/securitylevel/content/securityLevelPanel.inc.xul
+++ b/browser/components/securitylevel/content/securityLevelPanel.inc.xul
@@ -3,7 +3,10 @@
type="arrow"
orient="vertical"
level="top"
- hidden="true">
+ hidden="true"
+ onpopupshown="SecurityLevelPanel.onPopupShown(event);"
+ onpopuphidden="SecurityLevelPanel.onPopupHidden(event);"
+ >
<panelmultiview mainViewId="securityLevel-panelview">
<panelview id="securityLevel-panelview" descriptionheightworkaround="true">
<vbox class="panel-subview-body">
1
0
[tor-browser-build/master] Bug 30585: Provide clang 8 for Tor Browser 9
by gk@torproject.org 31 Jul '19
by gk@torproject.org 31 Jul '19
31 Jul '19
commit 4c2b3a98e04605ce7fcbd1c2c7c4864c6a5125a2
Author: Georg Koppen <gk(a)torproject.org>
Date: Thu May 23 12:02:51 2019 +0000
Bug 30585: Provide clang 8 for Tor Browser 9
Adding a clang project is mainly motivated by getting our
mingw-w64/clang toolchain for Windows set up (#28716). Clang is a
separate project and will replace the llvm one (which we use in parallel
for now) as we don't want to build the clang part every time, say, the
ming-w64 commit gets updated. Moreover, we need a recent enough clang on
the host system for building at least the Stylo part in Firefox anyway.
The patches for Windows and general set up is more or less following
build/build-clang/clang-8-mingw.json on the mozilla-esr68 branch.
---
keyring/clang.gpg | Bin 0 -> 7186 bytes
projects/clang/build | 45 ++
projects/clang/config | 45 ++
projects/clang/win-patches/llvm-objcopy-1.patch | 27 +
projects/clang/win-patches/llvm-objcopy-10.patch | 28 +
projects/clang/win-patches/llvm-objcopy-11.patch | 377 +++++++++++++
projects/clang/win-patches/llvm-objcopy-12.patch | 43 ++
projects/clang/win-patches/llvm-objcopy-2.patch | 665 +++++++++++++++++++++++
projects/clang/win-patches/llvm-objcopy-3.patch | 160 ++++++
projects/clang/win-patches/llvm-objcopy-4.patch | 222 ++++++++
projects/clang/win-patches/llvm-objcopy-5.patch | 61 +++
projects/clang/win-patches/llvm-objcopy-6.patch | 242 +++++++++
projects/clang/win-patches/llvm-objcopy-7.patch | 224 ++++++++
projects/clang/win-patches/llvm-objcopy-8.patch | 330 +++++++++++
projects/clang/win-patches/llvm-objcopy-9.patch | 260 +++++++++
15 files changed, 2729 insertions(+)
diff --git a/keyring/clang.gpg b/keyring/clang.gpg
new file mode 100644
index 0000000..15f0d8a
Binary files /dev/null and b/keyring/clang.gpg differ
diff --git a/projects/clang/build b/projects/clang/build
new file mode 100644
index 0000000..50576b4
--- /dev/null
+++ b/projects/clang/build
@@ -0,0 +1,45 @@
+#!/bin/bash
+[% c("var/set_default_env") -%]
+distdir=/var/tmp/dist/[% project %]
+mkdir -p /var/tmp/dist
+tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
+export PATH="/var/tmp/dist/cmake/bin:$PATH"
+[% IF c("var/linux") %]
+ # We need a link to our GCC, otherwise the system cc gets used which points to
+ # /usr/bin/gcc.
+ [% pc('gcc', 'var/setup', { compiler_tarfile => c('input_files_by_name/gcc'),
+ hardened_gcc => 0 }) %]
+ ln -s gcc /var/tmp/dist/gcc/bin/cc
+[% END -%]
+mkdir -p /var/tmp/build
+cd /var/tmp/build
+tar -xf $rootdir/[% c('input_files_by_name/llvm') %]
+tar -xf $rootdir/[% c('input_files_by_name/cfe') %]
+tar -xf $rootdir/[% c('input_files_by_name/libcxx') %]
+tar -xf $rootdir/[% c('input_files_by_name/libcxxabi') %]
+tar -xf $rootdir/[% c('input_files_by_name/lld') %]
+tar -xf $rootdir/[% c('input_files_by_name/compiler-rt') %]
+mv llvm-* llvm
+mv cfe-* llvm/tools/clang
+mv libcxx-* llvm/projects/libcxx
+mv libcxxabi-* llvm/projects/libcxxabi
+mv lld-* llvm/tools/lld
+mv compiler-rt-* llvm/projects/compiler-rt
+[% IF c("var/windows") -%]
+ # Patch order is important here
+ for i in {1..12}
+ do git apply $rootdir/win-patches/llvm-objcopy-$i.patch
+ done
+[% END %]
+cd llvm
+export LLVM_HOME=$(pwd)
+mkdir build
+cd build
+cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$distdir -DCMAKE_BUILD_TYPE:STRING=Release $LLVM_HOME
+make -j[% c("buildconf/num_procs") %]
+make install
+cd /var/tmp/dist
+[% c('tar', {
+ tar_src => [ project ],
+ tar_args => '-czf ' _ dest_dir _ '/' _ c('filename'),
+ }) %]
diff --git a/projects/clang/config b/projects/clang/config
new file mode 100644
index 0000000..f439cf7
--- /dev/null
+++ b/projects/clang/config
@@ -0,0 +1,45 @@
+# vim: filetype=yaml sw=2
+version: 8.0.0
+filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
+gpg_keyring: clang.gpg
+sig_ext: sig
+
+var:
+ container:
+ use_container: 1
+
+targets:
+ windows:
+ var:
+ arch_deps:
+ # We use git to apply patches
+ - git
+
+
+input_files:
+ - project: container-image
+ - name: '[% c("var/compiler") %]'
+ project: '[% c("var/compiler") %]'
+ enable: '[% c("var/linux") %]'
+ - project: cmake
+ name: cmake
+ - URL: 'https://releases.llvm.org/[% c("version") %]/llvm-[% c("version") %].src.tar.xz'
+ name: llvm
+ file_gpg_id: 1
+ - URL: 'https://releases.llvm.org/[% c("version") %]/cfe-[% c("version") %].src.tar.xz'
+ name: cfe
+ file_gpg_id: 1
+ - URL: 'https://releases.llvm.org/[% c("version") %]/libcxx-[% c("version") %].src.tar.xz'
+ name: libcxx
+ file_gpg_id: 1
+ - URL: 'https://releases.llvm.org/[% c("version") %]/libcxxabi-[% c("version") %].src.tar.xz'
+ name: libcxxabi
+ file_gpg_id: 1
+ - URL: 'https://releases.llvm.org/[% c("version") %]/lld-[% c("version") %].src.tar.xz'
+ name: lld
+ file_gpg_id: 1
+ - URL: 'https://releases.llvm.org/[% c("version") %]/compiler-rt-[% c("version") %].src.tar.xz'
+ name: compiler-rt
+ file_gpg_id: 1
+ - filename: win-patches
+ enable: '[% c("var/windows") %]'
diff --git a/projects/clang/win-patches/llvm-objcopy-1.patch b/projects/clang/win-patches/llvm-objcopy-1.patch
new file mode 100644
index 0000000..9c9f250
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-1.patch
@@ -0,0 +1,27 @@
+From a495c9ae6fb3367e6b59d8d245273ed3669754f0 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Sat, 19 Jan 2019 19:42:23 +0000
+Subject: [PATCH] [llvm-objcopy] [COFF] Remove a superfluous namespace
+ qualification. NFC.
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351658 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+index ceebf600b3a..437dccbd3d5 100644
+--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+@@ -78,7 +78,7 @@ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
+ }
+
+ void executeObjcopyOnBinary(const CopyConfig &Config,
+- object::COFFObjectFile &In, Buffer &Out) {
++ COFFObjectFile &In, Buffer &Out) {
+ COFFReader Reader(In);
+ Expected<std::unique_ptr<Object>> ObjOrErr = Reader.create();
+ if (!ObjOrErr)
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-10.patch b/projects/clang/win-patches/llvm-objcopy-10.patch
new file mode 100644
index 0000000..4aca911
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-10.patch
@@ -0,0 +1,28 @@
+From 1284ee3c47bab17ec081b5169633aea4f8abfd30 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Wed, 23 Jan 2019 09:12:53 +0000
+Subject: [PATCH] [llvm-objcopy] [COFF] Clear the unwritten tail of
+ coff_section::Header::Name
+
+This should fix the add-gnu-debuglink test on all buildbots.
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351934 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ tools/llvm-objcopy/COFF/Writer.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+index 05e46291c39..db897e2ff33 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+@@ -121,6 +121,7 @@ size_t COFFWriter::finalizeStringTable() {
+
+ for (auto &S : Obj.getMutableSections()) {
+ if (S.Name.size() > COFF::NameSize) {
++ memset(S.Header.Name, 0, sizeof(S.Header.Name));
+ snprintf(S.Header.Name, sizeof(S.Header.Name), "/%d",
+ (int)StrTabBuilder.getOffset(S.Name));
+ } else {
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-11.patch b/projects/clang/win-patches/llvm-objcopy-11.patch
new file mode 100644
index 0000000..9149b80
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-11.patch
@@ -0,0 +1,377 @@
+From 74c7d422cba163635394ec32f2b243b1de502a18 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Wed, 23 Jan 2019 11:54:51 +0000
+Subject: [PATCH] [llvm-objcopy] [COFF] Fix handling of aux symbols for big
+ objects
+
+The aux symbols were stored in an opaque std::vector<uint8_t>,
+with contents interpreted according to the rest of the symbol.
+
+All aux symbol types but one fit in 18 bytes (sizeof(coff_symbol16)),
+and if written to a bigobj, two extra padding bytes are written (as
+sizeof(coff_symbol32) is 20). In the storage agnostic intermediate
+representation, store the aux symbols as a series of coff_symbol16
+sized opaque blobs. (In practice, all such aux symbols only consist
+of one aux symbol, so this is more flexible than what reality needs.)
+
+The special case is the file aux symbols, which are written in
+potentially more than one aux symbol slot, without any padding,
+as one single long string. This can't be stored in the same opaque
+vector of fixed sized aux symbol entries. The file aux symbols will
+occupy a different number of aux symbol slots depending on the type
+of output object file. As nothing in the intermediate process needs
+to have accurate raw symbol indices, updating that is moved into the
+writer class.
+
+Differential Revision: https://reviews.llvm.org/D57009
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351947 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ .../llvm-objcopy/COFF/Inputs/bigobj.o.gz | Bin 0 -> 7841 bytes
+ test/tools/llvm-objcopy/COFF/bigobj.test | 35 +++++++++++++
+ .../llvm-objcopy/ELF/auto-remove-shndx.test | 2 +-
+ .../tools/llvm-objcopy/ELF/many-sections.test | 2 +-
+ test/tools/llvm-objcopy/ELF/remove-shndx.test | 2 +-
+ .../tools/llvm-objcopy/ELF/strict-no-add.test | 2 +-
+ .../llvm-objcopy/{ELF => }/Inputs/ungzip.py | 0
+ tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 6 +--
+ tools/llvm-objcopy/COFF/Object.cpp | 6 +--
+ tools/llvm-objcopy/COFF/Object.h | 18 ++++++-
+ tools/llvm-objcopy/COFF/Reader.cpp | 21 ++++++--
+ tools/llvm-objcopy/COFF/Writer.cpp | 49 +++++++++++++-----
+ tools/llvm-objcopy/COFF/Writer.h | 2 +-
+ 13 files changed, 115 insertions(+), 30 deletions(-)
+ create mode 100644 test/tools/llvm-objcopy/COFF/Inputs/bigobj.o.gz
+ create mode 100644 test/tools/llvm-objcopy/COFF/bigobj.test
+ rename test/tools/llvm-objcopy/{ELF => }/Inputs/ungzip.py (100%)
+
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/Inputs/bigobj.o.gz b/llvm/test/tools/llvm-objcopy/COFF/Inputs/bigobj.o.gz
+new file mode 100644
+index 0000000000000000000000000000000000000000..6435f4785ff76e0c6bca12f3e57bc6ad8888bece
+GIT binary patch
+literal 7841
+zcmb2|=3r3v^@w3&etUMmo^zoH`-kGKM_vfJsF<z%6+Sz#g6qq)pf0Hj#_r`4B7DML
+zW(h1l`+!x)t@&W-R@I~lyKmU3Ti&1Z=iKur;uBMy1MR!_ywlsouYY&-*4H1mU!Qw=
+z`RpIDkw;!V4(WOF_)B3`(Vt|~S>?L-b)Wx@^wig`HIMAw|N8V<v65oeyETs611{)_
+zm27RwTe)ENN|7SLgM~83N6}~qjE2By2#kinXb6mkz-S1JhQMeDjE2By2#kinXb6mk
+zz-S1JhQMeDjE2By2#kinXb6mkz-S1JhQMeDjE2By2#kgRokHNw|D97mKRo|%+Z6Ym
+z*X{Ku$4#4*Vqm}gyYR^b^Sc?_E*<<cFE#Q=*rt6OBmJeLZ=aoe_u9R>-w!^l5biDe
+p{d@nvw*mU6<NG83=jxn4_wt_G?yUy#YeOF~KhH^=cj<;Y0{~9Br>p<~
+
+literal 0
+HcmV?d00001
+
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/bigobj.test b/llvm/test/tools/llvm-objcopy/COFF/bigobj.test
+new file mode 100644
+index 00000000000..17968f12b8a
+--- /dev/null
++++ b/llvm/test/tools/llvm-objcopy/COFF/bigobj.test
+@@ -0,0 +1,35 @@
++RUN: %python %p/../Inputs/ungzip.py %p/Inputs/bigobj.o.gz > %t.in.o
++
++RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-BIG,SYMBOLS-ORIG
++
++# Do a plain copy, to check that section numbers in symbols referring
++# to sections outside of the small object format are handled correctly.
++RUN: llvm-objcopy -R '.text$4' %t.in.o %t.small.o
++RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-BIG,SYMBOLS-ORIG
++
++# Remove a section, making the section count fit into a small object.
++RUN: llvm-objcopy -R '.text$4' %t.in.o %t.small.o
++RUN: llvm-objdump -t %t.small.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-SMALL,SYMBOLS-REMOVED-SMALL
++
++# Add a .gnu_debuglink section, forcing the object back to big format.
++RUN: llvm-objcopy --add-gnu-debuglink=%t.in.o %t.small.o %t.big.o
++ llvm-objdump -t %t.big.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-BIG,SYMBOLS-REMOVED-BIG
++
++# In big object format, the .file symbol occupies one symbol table entry for
++# the auxillary data, but needs two entries in the small format, forcing the
++# raw symbol indices of later symbols to change.
++SYMBOLS: SYMBOL TABLE:
++SYMBOLS-NEXT: [ 0]{{.*}} (nx 1) {{.*}} .text
++SYMBOLS-NEXT: AUX scnlen
++SYMBOLS-SMALL-NEXT: [ 2]{{.*}} (nx 2) {{.*}} .file
++SYMBOLS-BIG-NEXT: [ 2]{{.*}} (nx 1) {{.*}} .file
++SYMBOLS-NEXT: AUX abcdefghijklmnopqrs
++SYMBOLS-SMALL-NEXT: [ 5]{{.*}} (nx 0) {{.*}} foo
++SYMBOLS-BIG-NEXT: [ 4]{{.*}} (nx 0) {{.*}} foo
++
++# Check that the section numbers outside of signed 16 bit int range
++# are represented properly. After removing one section, the section
++# numbers decrease.
++SYMBOLS-ORIG: [ 5](sec 65280){{.*}} symbol65280
++SYMBOLS-REMOVED-SMALL: [ 6](sec 65279){{.*}} symbol65280
++SYMBOLS-REMOVED-BIG: [ 5](sec 65279){{.*}} symbol65280
+diff --git a/llvm/test/tools/llvm-objcopy/ELF/auto-remove-shndx.test b/llvm/test/tools/llvm-objcopy/ELF/auto-remove-shndx.test
+index 5a23493fa94..8e6c788bf48 100644
+--- a/llvm/test/tools/llvm-objcopy/ELF/auto-remove-shndx.test
++++ b/llvm/test/tools/llvm-objcopy/ELF/auto-remove-shndx.test
+@@ -1,4 +1,4 @@
+-# RUN: %python %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
++# RUN: %python %p/../Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
+ # RUN: llvm-objcopy -R .text -R s0 -R s1 -R s2 -R s3 -R s4 -R s5 -R s6 %t %t2
+ # RUN: llvm-readobj --sections %t2 | FileCheck --check-prefix=SECS %s
+
+diff --git a/llvm/test/tools/llvm-objcopy/ELF/many-sections.test b/llvm/test/tools/llvm-objcopy/ELF/many-sections.test
+index 57239f32e4a..1dd41cfb10c 100644
+--- a/llvm/test/tools/llvm-objcopy/ELF/many-sections.test
++++ b/llvm/test/tools/llvm-objcopy/ELF/many-sections.test
+@@ -1,4 +1,4 @@
+-RUN: %python %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
++RUN: %python %p/../Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
+ RUN: llvm-objcopy %t %t2
+ RUN: llvm-readobj --file-headers %t2 | FileCheck --check-prefix=EHDR %s
+ RUN: llvm-readobj --sections %t2 | FileCheck --check-prefix=SECS %s
+diff --git a/llvm/test/tools/llvm-objcopy/ELF/remove-shndx.test b/llvm/test/tools/llvm-objcopy/ELF/remove-shndx.test
+index 6cc3a1a291f..53ca8e7f220 100644
+--- a/llvm/test/tools/llvm-objcopy/ELF/remove-shndx.test
++++ b/llvm/test/tools/llvm-objcopy/ELF/remove-shndx.test
+@@ -1,6 +1,6 @@
+ # This test checks to see that a .symtab_shndx section is added to any binary
+ # that needs it, even if the original was removed.
+-RUN: %python %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
++RUN: %python %p/../Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t
+ RUN: llvm-objcopy -R .symtab_shndx %t %t2
+ RUN: llvm-readobj --sections %t2 | FileCheck %s
+
+diff --git a/llvm/test/tools/llvm-objcopy/ELF/strict-no-add.test b/llvm/test/tools/llvm-objcopy/ELF/strict-no-add.test
+index 4f24df31bf9..348ab7c4fbd 100644
+--- a/llvm/test/tools/llvm-objcopy/ELF/strict-no-add.test
++++ b/llvm/test/tools/llvm-objcopy/ELF/strict-no-add.test
+@@ -1,7 +1,7 @@
+ # This test makes sure that sections added at the end that don't have symbols
+ # defined in them don't trigger the creation of a large index table.
+
+-RUN: %python %p/Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t.0
++RUN: %python %p/../Inputs/ungzip.py %p/Inputs/many-sections.o.gz > %t.0
+ RUN: cat %p/Inputs/alloc-symtab.o > %t
+ RUN: llvm-objcopy -R .text -R s0 -R s1 -R s2 -R s3 -R s4 -R s5 -R s6 %t.0 %t2
+ RUN: llvm-objcopy --add-section=.s0=%t --add-section=.s1=%t --add-section=.s2=%t %t2 %t2
+diff --git a/llvm/test/tools/llvm-objcopy/ELF/Inputs/ungzip.py b/llvm/test/tools/llvm-objcopy/Inputs/ungzip.py
+similarity index 100%
+rename from llvm/test/tools/llvm-objcopy/ELF/Inputs/ungzip.py
+rename to llvm/test/tools/llvm-objcopy/Inputs/ungzip.py
+diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+index 20adbe11e7a..64b4e79a4e0 100644
+--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+@@ -37,7 +37,7 @@ static uint64_t getNextRVA(const Object &Obj) {
+ return 0;
+ const Section &Last = Obj.getSections().back();
+ return alignTo(Last.Header.VirtualAddress + Last.Header.VirtualSize,
+- Obj.PeHeader.SectionAlignment);
++ Obj.IsPE ? Obj.PeHeader.SectionAlignment : 1);
+ }
+
+ static uint32_t getCRC32(StringRef Data) {
+@@ -74,8 +74,8 @@ static void addGnuDebugLink(Object &Obj, StringRef DebugLinkFile) {
+ Sec.Name = ".gnu_debuglink";
+ Sec.Header.VirtualSize = Sec.getContents().size();
+ Sec.Header.VirtualAddress = StartRVA;
+- Sec.Header.SizeOfRawData =
+- alignTo(Sec.Header.VirtualSize, Obj.PeHeader.FileAlignment);
++ Sec.Header.SizeOfRawData = alignTo(Sec.Header.VirtualSize,
++ Obj.IsPE ? Obj.PeHeader.FileAlignment : 1);
+ // Sec.Header.PointerToRawData is filled in by the writer.
+ Sec.Header.PointerToRelocations = 0;
+ Sec.Header.PointerToLinenumbers = 0;
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.cpp b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+index 8c382c1faef..0ad5a05a144 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+@@ -26,12 +26,8 @@ void Object::addSymbols(ArrayRef<Symbol> NewSymbols) {
+
+ void Object::updateSymbols() {
+ SymbolMap = DenseMap<size_t, Symbol *>(Symbols.size());
+- size_t RawSymIndex = 0;
+- for (Symbol &Sym : Symbols) {
++ for (Symbol &Sym : Symbols)
+ SymbolMap[Sym.UniqueId] = &Sym;
+- Sym.RawIndex = RawSymIndex;
+- RawSymIndex += 1 + Sym.Sym.NumberOfAuxSymbols;
+- }
+ }
+
+ const Symbol *Object::findSymbol(size_t UniqueId) const {
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.h b/llvm/tools/llvm-objcopy/COFF/Object.h
+index afa272286ef..21475b06862 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.h
++++ b/llvm/tools/llvm-objcopy/COFF/Object.h
+@@ -66,10 +66,24 @@ private:
+ std::vector<uint8_t> OwnedContents;
+ };
+
++struct AuxSymbol {
++ AuxSymbol(ArrayRef<uint8_t> In) {
++ assert(In.size() == sizeof(Opaque));
++ std::copy(In.begin(), In.end(), Opaque);
++ }
++
++ ArrayRef<uint8_t> getRef() const {
++ return ArrayRef<uint8_t>(Opaque, sizeof(Opaque));
++ }
++
++ uint8_t Opaque[sizeof(object::coff_symbol16)];
++};
++
+ struct Symbol {
+ object::coff_symbol32 Sym;
+ StringRef Name;
+- std::vector<uint8_t> AuxData;
++ std::vector<AuxSymbol> AuxData;
++ StringRef AuxFile;
+ ssize_t TargetSectionId;
+ ssize_t AssociativeComdatTargetSectionId = 0;
+ Optional<size_t> WeakTargetSymbolId;
+@@ -132,7 +146,7 @@ private:
+
+ ssize_t NextSectionUniqueId = 1; // Allow a UniqueId 0 to mean undefined.
+
+- // Update SymbolMap and RawIndex in each Symbol.
++ // Update SymbolMap.
+ void updateSymbols();
+
+ // Update SectionMap and Index in each Section.
+diff --git a/llvm/tools/llvm-objcopy/COFF/Reader.cpp b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+index 87dd60a43cf..7270bbf94de 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Reader.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+@@ -107,9 +107,24 @@ Error COFFReader::readSymbols(Object &Obj, bool IsBigObj) const {
+ *reinterpret_cast<const coff_symbol16 *>(SymRef.getRawPtr()));
+ if (auto EC = COFFObj.getSymbolName(SymRef, Sym.Name))
+ return errorCodeToError(EC);
+- Sym.AuxData = COFFObj.getSymbolAuxData(SymRef);
+- assert((Sym.AuxData.size() %
+- (IsBigObj ? sizeof(coff_symbol32) : sizeof(coff_symbol16))) == 0);
++
++ ArrayRef<uint8_t> AuxData = COFFObj.getSymbolAuxData(SymRef);
++ size_t SymSize = IsBigObj ? sizeof(coff_symbol32) : sizeof(coff_symbol16);
++ assert(AuxData.size() == SymSize * SymRef.getNumberOfAuxSymbols());
++ // The auxillary symbols are structs of sizeof(coff_symbol16) each.
++ // In the big object format (where symbols are coff_symbol32), each
++ // auxillary symbol is padded with 2 bytes at the end. Copy each
++ // auxillary symbol to the Sym.AuxData vector. For file symbols,
++ // the whole range of aux symbols are interpreted as one null padded
++ // string instead.
++ if (SymRef.isFileRecord())
++ Sym.AuxFile = StringRef(reinterpret_cast<const char *>(AuxData.data()),
++ AuxData.size())
++ .rtrim('\0');
++ else
++ for (size_t I = 0; I < SymRef.getNumberOfAuxSymbols(); I++)
++ Sym.AuxData.push_back(AuxData.slice(I * SymSize, sizeof(AuxSymbol)));
++
+ // Find the unique id of the section
+ if (SymRef.getSectionNumber() <=
+ 0) // Special symbol (undefined/absolute/debug)
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+index db897e2ff33..6e69c597217 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+@@ -55,7 +55,8 @@ Error COFFWriter::finalizeSymbolContents() {
+ if (Sym.Sym.NumberOfAuxSymbols == 1 &&
+ Sym.Sym.StorageClass == IMAGE_SYM_CLASS_STATIC) {
+ coff_aux_section_definition *SD =
+- reinterpret_cast<coff_aux_section_definition *>(Sym.AuxData.data());
++ reinterpret_cast<coff_aux_section_definition *>(
++ Sym.AuxData[0].Opaque);
+ uint32_t SDSectionNumber;
+ if (Sym.AssociativeComdatTargetSectionId == 0) {
+ // Not a comdat associative section; just set the Number field to
+@@ -79,7 +80,7 @@ Error COFFWriter::finalizeSymbolContents() {
+ // we want to set. Only >= 1 would be required, but only == 1 makes sense.
+ if (Sym.WeakTargetSymbolId && Sym.Sym.NumberOfAuxSymbols == 1) {
+ coff_aux_weak_external *WE =
+- reinterpret_cast<coff_aux_weak_external *>(Sym.AuxData.data());
++ reinterpret_cast<coff_aux_weak_external *>(Sym.AuxData[0].Opaque);
+ const Symbol *Target = Obj.findSymbol(*Sym.WeakTargetSymbolId);
+ if (Target == nullptr)
+ return createStringError(object_error::invalid_symbol_index,
+@@ -141,13 +142,26 @@ size_t COFFWriter::finalizeStringTable() {
+
+ template <class SymbolTy>
+ std::pair<size_t, size_t> COFFWriter::finalizeSymbolTable() {
+- size_t SymTabSize = Obj.getSymbols().size() * sizeof(SymbolTy);
+- for (const auto &S : Obj.getSymbols())
+- SymTabSize += S.AuxData.size();
+- return std::make_pair(SymTabSize, sizeof(SymbolTy));
++ size_t RawSymIndex = 0;
++ for (auto &S : Obj.getMutableSymbols()) {
++ // Symbols normally have NumberOfAuxSymbols set correctly all the time.
++ // For file symbols, we need to know the output file's symbol size to be
++ // able to calculate the number of slots it occupies.
++ if (!S.AuxFile.empty())
++ S.Sym.NumberOfAuxSymbols =
++ alignTo(S.AuxFile.size(), sizeof(SymbolTy)) / sizeof(SymbolTy);
++ S.RawIndex = RawSymIndex;
++ RawSymIndex += 1 + S.Sym.NumberOfAuxSymbols;
++ }
++ return std::make_pair(RawSymIndex * sizeof(SymbolTy), sizeof(SymbolTy));
+ }
+
+ Error COFFWriter::finalize(bool IsBigObj) {
++ size_t SymTabSize, SymbolSize;
++ std::tie(SymTabSize, SymbolSize) = IsBigObj
++ ? finalizeSymbolTable<coff_symbol32>()
++ : finalizeSymbolTable<coff_symbol16>();
++
+ if (Error E = finalizeRelocTargets())
+ return E;
+ if (Error E = finalizeSymbolContents())
+@@ -199,10 +213,6 @@ Error COFFWriter::finalize(bool IsBigObj) {
+ }
+
+ size_t StrTabSize = finalizeStringTable();
+- size_t SymTabSize, SymbolSize;
+- std::tie(SymTabSize, SymbolSize) = IsBigObj
+- ? finalizeSymbolTable<coff_symbol32>()
+- : finalizeSymbolTable<coff_symbol16>();
+
+ size_t PointerToSymbolTable = FileSize;
+ // StrTabSize <= 4 is the size of an empty string table, only consisting
+@@ -312,8 +322,23 @@ template <class SymbolTy> void COFFWriter::writeSymbolStringTables() {
+ copySymbol<SymbolTy, coff_symbol32>(*reinterpret_cast<SymbolTy *>(Ptr),
+ S.Sym);
+ Ptr += sizeof(SymbolTy);
+- std::copy(S.AuxData.begin(), S.AuxData.end(), Ptr);
+- Ptr += S.AuxData.size();
++ if (!S.AuxFile.empty()) {
++ // For file symbols, just write the string into the aux symbol slots,
++ // assuming that the unwritten parts are initialized to zero in the memory
++ // mapped file.
++ std::copy(S.AuxFile.begin(), S.AuxFile.end(), Ptr);
++ Ptr += S.Sym.NumberOfAuxSymbols * sizeof(SymbolTy);
++ } else {
++ // For other auxillary symbols, write their opaque payload into one symbol
++ // table slot each. For big object files, the symbols are larger than the
++ // opaque auxillary symbol struct and we leave padding at the end of each
++ // entry.
++ for (const AuxSymbol &AuxSym : S.AuxData) {
++ ArrayRef<uint8_t> Ref = AuxSym.getRef();
++ std::copy(Ref.begin(), Ref.end(), Ptr);
++ Ptr += sizeof(SymbolTy);
++ }
++ }
+ }
+ if (StrTabBuilder.getSize() > 4 || !Obj.IsPE) {
+ // Always write a string table in object files, even an empty one.
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.h b/llvm/tools/llvm-objcopy/COFF/Writer.h
+index 9b1cfa91d00..681a8d5e4a6 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.h
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.h
+@@ -30,11 +30,11 @@ class COFFWriter {
+ size_t SizeOfInitializedData;
+ StringTableBuilder StrTabBuilder;
+
++ template <class SymbolTy> std::pair<size_t, size_t> finalizeSymbolTable();
+ Error finalizeRelocTargets();
+ Error finalizeSymbolContents();
+ void layoutSections();
+ size_t finalizeStringTable();
+- template <class SymbolTy> std::pair<size_t, size_t> finalizeSymbolTable();
+
+ Error finalize(bool IsBigObj);
+
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-12.patch b/projects/clang/win-patches/llvm-objcopy-12.patch
new file mode 100644
index 0000000..35dec30
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-12.patch
@@ -0,0 +1,43 @@
+From abacd83232acf69d7cbacd53fc2f9aae66c1a32e Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Wed, 23 Jan 2019 11:54:55 +0000
+Subject: [PATCH] [llvm-objcopy] [COFF] Error out on use of unhandled options
+
+Prefer erroring out than silently not doing what was requested.
+
+Differential Revision: https://reviews.llvm.org/D57045
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351948 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+index 64b4e79a4e0..b7b3d3cb629 100644
+--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+@@ -170,6 +170,21 @@ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
+ if (!Config.AddGnuDebugLink.empty())
+ addGnuDebugLink(Obj, Config.AddGnuDebugLink);
+
++ if (!Config.BuildIdLinkDir.empty() || Config.BuildIdLinkInput ||
++ Config.BuildIdLinkOutput || !Config.SplitDWO.empty() ||
++ !Config.SymbolsPrefix.empty() || !Config.AddSection.empty() ||
++ !Config.DumpSection.empty() || !Config.KeepSection.empty() ||
++ !Config.SymbolsToGlobalize.empty() || !Config.SymbolsToKeep.empty() ||
++ !Config.SymbolsToLocalize.empty() || !Config.SymbolsToWeaken.empty() ||
++ !Config.SymbolsToKeepGlobal.empty() || !Config.SectionsToRename.empty() ||
++ !Config.SymbolsToRename.empty() || Config.ExtractDWO ||
++ Config.KeepFileSymbols || Config.LocalizeHidden || Config.PreserveDates ||
++ Config.StripDWO || Config.StripNonAlloc || Config.StripSections ||
++ Config.Weaken || Config.DecompressDebugSections) {
++ return createStringError(llvm::errc::invalid_argument,
++ "Option not supported by llvm-objcopy for COFF");
++ }
++
+ return Error::success();
+ }
+
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-2.patch b/projects/clang/win-patches/llvm-objcopy-2.patch
new file mode 100644
index 0000000..41e7a94
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-2.patch
@@ -0,0 +1,665 @@
+From 2ccafacb7ddd740054dbee06655749ebc55a4d86 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Sat, 19 Jan 2019 19:42:35 +0000
+Subject: [PATCH] [llvm-objcopy] [COFF] Add support for removing sections
+
+Differential Revision: https://reviews.llvm.org/D56683
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351660 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ .../llvm-objcopy/COFF/remove-section.test | 210 ++++++++++++++++++
+ tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 10 +-
+ tools/llvm-objcopy/COFF/Object.cpp | 63 ++++++
+ tools/llvm-objcopy/COFF/Object.h | 27 ++-
+ tools/llvm-objcopy/COFF/Reader.cpp | 31 ++-
+ tools/llvm-objcopy/COFF/Writer.cpp | 68 ++++--
+ tools/llvm-objcopy/COFF/Writer.h | 1 +
+ 7 files changed, 391 insertions(+), 19 deletions(-)
+ create mode 100644 test/tools/llvm-objcopy/COFF/remove-section.test
+
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/remove-section.test b/llvm/test/tools/llvm-objcopy/COFF/remove-section.test
+new file mode 100644
+index 00000000000..b3dfb0b98cb
+--- /dev/null
++++ b/llvm/test/tools/llvm-objcopy/COFF/remove-section.test
+@@ -0,0 +1,210 @@
++# RUN: yaml2obj %s > %t.in.o
++#
++# RUN: llvm-objdump -section-headers %t.in.o | FileCheck %s --check-prefixes=SECTIONS-PRE
++# RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS-PRE
++#
++# RUN: llvm-objcopy -R .bss %t.in.o %t.remove-bss.o
++# RUN: llvm-objdump -section-headers %t.remove-bss.o | FileCheck %s --check-prefix=SECTIONS-REMOVE-BSS
++# RUN: llvm-objdump -t %t.remove-bss.o | FileCheck %s --check-prefix=SYMBOLS-REMOVE-BSS
++#
++# RUN: llvm-objcopy --remove-section .bss %t.in.o %t.cmp.o
++# RUN: cmp %t.remove-bss.o %t.cmp.o
++#
++# RUN: llvm-objcopy -R .text %t.in.o %t.remove-text.o
++# RUN: llvm-objdump -section-headers %t.remove-text.o | FileCheck %s --check-prefix=SECTIONS-REMOVE-TEXT
++# RUN: llvm-objdump -t %t.remove-text.o | FileCheck %s --check-prefix=SYMBOLS-REMOVE-TEXT
++#
++# RUN: not llvm-objcopy -R .comdat %t.in.o %t.remove-comdat.o 2>&1 | FileCheck %s --check-prefix=ERROR-RELOC
++#
++# RUN: llvm-objcopy -R .text -R .comdat %t.in.o %t.remove-text-comdat.o
++# RUN: llvm-objdump -section-headers %t.remove-text-comdat.o | FileCheck %s --check-prefix=SECTIONS-REMOVE-TEXT-COMDAT
++# RUN: llvm-objdump -t %t.remove-text-comdat.o | FileCheck %s --check-prefix=SYMBOLS-REMOVE-TEXT-COMDAT
++#
++#
++# SECTIONS-PRE: Sections:
++# SECTIONS-PRE-NEXT: Idx Name
++# SECTIONS-PRE-NEXT: 0 .text
++# SECTIONS-PRE-NEXT: 1 .bss
++# SECTIONS-PRE-NEXT: 2 .comdat
++# SECTIONS-PRE-NEXT: 3 .associative
++# SECTIONS-PRE-EMPTY:
++#
++# SYMBOLS-PRE: SYMBOL TABLE:
++# SYMBOLS-PRE-NEXT: {{.*}}(sec -1){{.*}} @feat.00
++# SYMBOLS-PRE-NEXT: {{.*}}(sec 1){{.*}} .text
++# SYMBOLS-PRE-NEXT: AUX scnlen {{.*}} assoc 1 comdat 0
++# SYMBOLS-PRE-NEXT: {{.*}}(sec 2){{.*}} .bss
++# SYMBOLS-PRE-NEXT: AUX scnlen {{.*}} assoc 2 comdat 0
++# SYMBOLS-PRE-NEXT: {{.*}}(sec 4){{.*}} .associative
++# SYMBOLS-PRE-NEXT: AUX scnlen {{.*}} assoc 3 comdat 5
++# SYMBOLS-PRE-NEXT: {{.*}}(sec 3){{.*}} .comdat
++# SYMBOLS-PRE-NEXT: AUX scnlen {{.*}} assoc 3 comdat 2
++# SYMBOLS-PRE-NEXT: {{.*}}(sec 3){{.*}} foo
++# SYMBOLS-PRE-NEXT: {{.*}}(sec 1){{.*}} main
++# SYMBOLS-PRE-EMPTY:
++#
++#
++# Removing the .bss section removes one symbol and its aux symbol,
++# and updates the section indices in symbols pointing to later
++# symbols, including the aux section defintitions.
++#
++# Testing that the absolute symbol @feat.00 survives the section number
++# mangling.
++#
++# SECTIONS-REMOVE-BSS: Sections:
++# SECTIONS-REMOVE-BSS-NEXT: Idx Name
++# SECTIONS-REMOVE-BSS-NEXT: 0 .text
++# SECTIONS-REMOVE-BSS-NEXT: 1 .comdat
++# SECTIONS-REMOVE-BSS-NEXT: 2 .associative
++# SECTIONS-REMOVE-BSS-EMPTY:
++#
++# SYMBOLS-REMOVE-BSS: SYMBOL TABLE:
++# SYMBOLS-REMOVE-BSS-NEXT: {{.*}}(sec -1){{.*}} @feat.00
++# SYMBOLS-REMOVE-BSS-NEXT: {{.*}}(sec 1){{.*}} .text
++# SYMBOLS-REMOVE-BSS-NEXT: AUX scnlen {{.*}} assoc 1 comdat 0
++# SYMBOLS-REMOVE-BSS-NEXT: {{.*}}(sec 3){{.*}} .associative
++# SYMBOLS-REMOVE-BSS-NEXT: AUX scnlen {{.*}} assoc 2 comdat 5
++# SYMBOLS-REMOVE-BSS-NEXT: {{.*}}(sec 2){{.*}} .comdat
++# SYMBOLS-REMOVE-BSS-NEXT: AUX scnlen {{.*}} assoc 2 comdat 2
++# SYMBOLS-REMOVE-BSS-NEXT: {{.*}}(sec 2){{.*}} foo
++# SYMBOLS-REMOVE-BSS-NEXT: {{.*}}(sec 1){{.*}} main
++# SYMBOLS-REMOVE-BSS-EMPTY:
++#
++#
++# Removing the .text section is ok and just removes the external symbol
++# referring to it.
++#
++# SECTIONS-REMOVE-TEXT: Sections:
++# SECTIONS-REMOVE-TEXT-NEXT: Idx Name
++# SECTIONS-REMOVE-TEXT-NEXT: 0 .bss
++# SECTIONS-REMOVE-TEXT-NEXT: 1 .comdat
++# SECTIONS-REMOVE-TEXT-NEXT: 2 .associative
++# SECTIONS-REMOVE-TEXT-EMPTY:
++#
++# SYMBOLS-REMOVE-TEXT: SYMBOL TABLE:
++# SYMBOLS-REMOVE-TEXT-NEXT: {{.*}}(sec -1){{.*}} @feat.00
++# SYMBOLS-REMOVE-TEXT-NEXT: {{.*}}(sec 1){{.*}} .bss
++# SYMBOLS-REMOVE-TEXT-NEXT: AUX scnlen {{.*}} assoc 1 comdat 0
++# SYMBOLS-REMOVE-TEXT-NEXT: {{.*}}(sec 3){{.*}} .associative
++# SYMBOLS-REMOVE-TEXT-NEXT: AUX scnlen {{.*}} assoc 2 comdat 5
++# SYMBOLS-REMOVE-TEXT-NEXT: {{.*}}(sec 2){{.*}} .comdat
++# SYMBOLS-REMOVE-TEXT-NEXT: AUX scnlen {{.*}} assoc 2 comdat 2
++# SYMBOLS-REMOVE-TEXT-NEXT: {{.*}}(sec 2){{.*}} foo
++# SYMBOLS-REMOVE-TEXT-EMPTY:
++#
++#
++# Removing the .comdat section fails, since the .text section has relocations
++# against it.
++#
++# ERROR-RELOC: Relocation target foo ({{.*}}) not found
++#
++#
++# Removing the .comdat section and .text (with a relocation against .comdat)
++# works, as it also removes the .associative section transitively.
++#
++# SECTIONS-REMOVE-TEXT-COMDAT: Sections:
++# SECTIONS-REMOVE-TEXT-COMDAT-NEXT: Idx Name
++# SECTIONS-REMOVE-TEXT-COMDAT-NEXT: 0 .bss
++# SECTIONS-REMOVE-TEXT-COMDAT-EMPTY:
++#
++# SYMBOLS-REMOVE-TEXT-COMDAT: SYMBOL TABLE:
++# SYMBOLS-REMOVE-TEXT-COMDAT-NEXT: {{.*}}(sec -1){{.*}} @feat.00
++# SYMBOLS-REMOVE-TEXT-COMDAT-NEXT: {{.*}}(sec 1){{.*}} .bss
++# SYMBOLS-REMOVE-TEXT-COMDAT-NEXT: AUX scnlen {{.*}} assoc 1 comdat 0
++# SYMBOLS-REMOVE-TEXT-COMDAT-EMPTY:
++
++--- !COFF
++header:
++ Machine: IMAGE_FILE_MACHINE_AMD64
++ Characteristics: [ ]
++sections:
++ - Name: .text
++ Characteristics: [ ]
++ Alignment: 4
++ SectionData: 488B0500000000C3
++ Relocations:
++ - VirtualAddress: 3
++ SymbolName: foo
++ Type: IMAGE_REL_AMD64_REL32
++ - Name: .bss
++ Characteristics: [ ]
++ Alignment: 4
++ SectionData: ''
++ - Name: .comdat
++ Characteristics: [ IMAGE_SCN_LNK_COMDAT ]
++ Alignment: 1
++ SectionData: '2A000000'
++ - Name: .associative
++ Characteristics: [ IMAGE_SCN_LNK_COMDAT ]
++ Alignment: 1
++ SectionData: '0000000000000000'
++symbols:
++ - Name: '@feat.00'
++ Value: 0
++ SectionNumber: -1
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_STATIC
++ - Name: .text
++ Value: 0
++ SectionNumber: 1
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_STATIC
++ SectionDefinition:
++ Length: 8
++ NumberOfRelocations: 1
++ NumberOfLinenumbers: 0
++ CheckSum: 583624169
++ Number: 1
++ - Name: .bss
++ Value: 0
++ SectionNumber: 2
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_STATIC
++ SectionDefinition:
++ Length: 0
++ NumberOfRelocations: 0
++ NumberOfLinenumbers: 0
++ CheckSum: 0
++ Number: 2
++ - Name: .associative
++ Value: 0
++ SectionNumber: 4
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_STATIC
++ SectionDefinition:
++ Length: 8
++ NumberOfRelocations: 0
++ NumberOfLinenumbers: 0
++ CheckSum: 0
++ Number: 3
++ Selection: IMAGE_COMDAT_SELECT_ASSOCIATIVE
++ - Name: .comdat
++ Value: 0
++ SectionNumber: 3
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_STATIC
++ SectionDefinition:
++ Length: 4
++ NumberOfRelocations: 0
++ NumberOfLinenumbers: 0
++ CheckSum: 3482275674
++ Number: 3
++ Selection: IMAGE_COMDAT_SELECT_ANY
++ - Name: foo
++ Value: 0
++ SectionNumber: 3
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++ - Name: main
++ Value: 0
++ SectionNumber: 1
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++...
+diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+index 437dccbd3d5..dd2e4829218 100644
+--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+@@ -27,9 +27,17 @@ using namespace object;
+ using namespace COFF;
+
+ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
++ // Perform the actual section removals.
++ Obj.removeSections([&Config](const Section &Sec) {
++ if (is_contained(Config.ToRemove, Sec.Name))
++ return true;
++
++ return false;
++ });
++
+ // StripAll removes all symbols and thus also removes all relocations.
+ if (Config.StripAll || Config.StripAllGNU)
+- for (Section &Sec : Obj.Sections)
++ for (Section &Sec : Obj.getMutableSections())
+ Sec.Relocs.clear();
+
+ // If we need to do per-symbol removals, initialize the Referenced field.
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.cpp b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+index e58e161e7d2..e19cea6aa9d 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+@@ -7,6 +7,7 @@
+ //===----------------------------------------------------------------------===//
+
+ #include "Object.h"
++#include "llvm/ADT/DenseSet.h"
+ #include <algorithm>
+
+ namespace llvm {
+@@ -64,6 +65,68 @@ Error Object::markSymbols() {
+ return Error::success();
+ }
+
++void Object::addSections(ArrayRef<Section> NewSections) {
++ for (Section S : NewSections) {
++ S.UniqueId = NextSectionUniqueId++;
++ Sections.emplace_back(S);
++ }
++ updateSections();
++}
++
++void Object::updateSections() {
++ SectionMap = DenseMap<ssize_t, Section *>(Sections.size());
++ size_t Index = 1;
++ for (Section &S : Sections) {
++ SectionMap[S.UniqueId] = &S;
++ S.Index = Index++;
++ }
++}
++
++const Section *Object::findSection(ssize_t UniqueId) const {
++ auto It = SectionMap.find(UniqueId);
++ if (It == SectionMap.end())
++ return nullptr;
++ return It->second;
++}
++
++void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
++ DenseSet<ssize_t> AssociatedSections;
++ auto RemoveAssociated = [&AssociatedSections](const Section &Sec) {
++ return AssociatedSections.count(Sec.UniqueId) == 1;
++ };
++ do {
++ DenseSet<ssize_t> RemovedSections;
++ Sections.erase(
++ std::remove_if(std::begin(Sections), std::end(Sections),
++ [ToRemove, &RemovedSections](const Section &Sec) {
++ bool Remove = ToRemove(Sec);
++ if (Remove)
++ RemovedSections.insert(Sec.UniqueId);
++ return Remove;
++ }),
++ std::end(Sections));
++ // Remove all symbols referring to the removed sections.
++ AssociatedSections.clear();
++ Symbols.erase(
++ std::remove_if(
++ std::begin(Symbols), std::end(Symbols),
++ [&RemovedSections, &AssociatedSections](const Symbol &Sym) {
++ // If there are sections that are associative to a removed
++ // section,
++ // remove those as well as nothing will include them (and we can't
++ // leave them dangling).
++ if (RemovedSections.count(Sym.AssociativeComdatTargetSectionId) ==
++ 1)
++ AssociatedSections.insert(Sym.TargetSectionId);
++ return RemovedSections.count(Sym.TargetSectionId) == 1;
++ }),
++ std::end(Symbols));
++ ToRemove = RemoveAssociated;
++ } while (!AssociatedSections.empty());
++ updateSections();
++ updateSymbols();
++}
++
+ } // end namespace coff
+ } // end namespace objcopy
+ } // end namespace llvm
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.h b/llvm/tools/llvm-objcopy/COFF/Object.h
+index e6147c40b7c..a73e93620d3 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.h
++++ b/llvm/tools/llvm-objcopy/COFF/Object.h
+@@ -37,12 +37,16 @@ struct Section {
+ ArrayRef<uint8_t> Contents;
+ std::vector<Relocation> Relocs;
+ StringRef Name;
++ ssize_t UniqueId;
++ size_t Index;
+ };
+
+ struct Symbol {
+ object::coff_symbol32 Sym;
+ StringRef Name;
+- ArrayRef<uint8_t> AuxData;
++ std::vector<uint8_t> AuxData;
++ ssize_t TargetSectionId;
++ ssize_t AssociativeComdatTargetSectionId = 0;
+ size_t UniqueId;
+ size_t RawIndex;
+ bool Referenced;
+@@ -61,7 +65,6 @@ struct Object {
+ uint32_t BaseOfData = 0; // pe32plus_header lacks this field.
+
+ std::vector<object::data_directory> DataDirectories;
+- std::vector<Section> Sections;
+
+ ArrayRef<Symbol> getSymbols() const { return Symbols; }
+ // This allows mutating individual Symbols, but not mutating the list
+@@ -79,14 +82,34 @@ struct Object {
+ // all sections.
+ Error markSymbols();
+
++ ArrayRef<Section> getSections() const { return Sections; }
++ // This allows mutating individual Sections, but not mutating the list
++ // of symbols itself.
++ iterator_range<std::vector<Section>::iterator> getMutableSections() {
++ return make_range(Sections.begin(), Sections.end());
++ }
++
++ const Section *findSection(ssize_t UniqueId) const;
++
++ void addSections(ArrayRef<Section> NewSections);
++ void removeSections(function_ref<bool(const Section &)> ToRemove);
++
+ private:
+ std::vector<Symbol> Symbols;
+ DenseMap<size_t, Symbol *> SymbolMap;
+
+ size_t NextSymbolUniqueId = 0;
+
++ std::vector<Section> Sections;
++ DenseMap<ssize_t, Section *> SectionMap;
++
++ ssize_t NextSectionUniqueId = 1; // Allow a UniqueId 0 to mean undefined.
++
+ // Update SymbolMap and RawIndex in each Symbol.
+ void updateSymbols();
++
++ // Update SectionMap and Index in each Section.
++ void updateSections();
+ };
+
+ // Copy between coff_symbol16 and coff_symbol32.
+diff --git a/llvm/tools/llvm-objcopy/COFF/Reader.cpp b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+index d794042ae24..c8abe2913a2 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Reader.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+@@ -11,6 +11,7 @@
+ #include "llvm-objcopy.h"
+ #include "llvm/ADT/ArrayRef.h"
+ #include "llvm/ADT/StringRef.h"
++#include "llvm/BinaryFormat/COFF.h"
+ #include "llvm/Object/COFF.h"
+ #include "llvm/Support/ErrorHandling.h"
+ #include <cstddef>
+@@ -21,6 +22,7 @@ namespace objcopy {
+ namespace coff {
+
+ using namespace object;
++using namespace COFF;
+
+ Error COFFReader::readExecutableHeaders(Object &Obj) const {
+ const dos_header *DH = COFFObj.getDOSHeader();
+@@ -58,13 +60,14 @@ Error COFFReader::readExecutableHeaders(Object &Obj) const {
+ }
+
+ Error COFFReader::readSections(Object &Obj) const {
++ std::vector<Section> Sections;
+ // Section indexing starts from 1.
+ for (size_t I = 1, E = COFFObj.getNumberOfSections(); I <= E; I++) {
+ const coff_section *Sec;
+ if (auto EC = COFFObj.getSection(I, Sec))
+ return errorCodeToError(EC);
+- Obj.Sections.push_back(Section());
+- Section &S = Obj.Sections.back();
++ Sections.push_back(Section());
++ Section &S = Sections.back();
+ S.Header = *Sec;
+ if (auto EC = COFFObj.getSectionContents(Sec, S.Contents))
+ return errorCodeToError(EC);
+@@ -77,12 +80,14 @@ Error COFFReader::readSections(Object &Obj) const {
+ return make_error<StringError>("Extended relocations not supported yet",
+ object_error::parse_failed);
+ }
++ Obj.addSections(Sections);
+ return Error::success();
+ }
+
+ Error COFFReader::readSymbols(Object &Obj, bool IsBigObj) const {
+ std::vector<Symbol> Symbols;
+ Symbols.reserve(COFFObj.getRawNumberOfSymbols());
++ ArrayRef<Section> Sections = Obj.getSections();
+ for (uint32_t I = 0, E = COFFObj.getRawNumberOfSymbols(); I < E;) {
+ Expected<COFFSymbolRef> SymOrErr = COFFObj.getSymbol(I);
+ if (!SymOrErr)
+@@ -103,6 +108,26 @@ Error COFFReader::readSymbols(Object &Obj, bool IsBigObj) const {
+ Sym.AuxData = COFFObj.getSymbolAuxData(SymRef);
+ assert((Sym.AuxData.size() %
+ (IsBigObj ? sizeof(coff_symbol32) : sizeof(coff_symbol16))) == 0);
++ // Find the unique id of the section
++ if (SymRef.getSectionNumber() <=
++ 0) // Special symbol (undefined/absolute/debug)
++ Sym.TargetSectionId = SymRef.getSectionNumber();
++ else if (static_cast<uint32_t>(SymRef.getSectionNumber() - 1) <
++ Sections.size())
++ Sym.TargetSectionId = Sections[SymRef.getSectionNumber() - 1].UniqueId;
++ else
++ return make_error<StringError>("Section number out of range",
++ object_error::parse_failed);
++ // For section definitions, check if it is comdat associative, and if
++ // it is, find the target section unique id.
++ const coff_aux_section_definition *SD = SymRef.getSectionDefinition();
++ if (SD && SD->Selection == IMAGE_COMDAT_SELECT_ASSOCIATIVE) {
++ int32_t Index = SD->getNumber(IsBigObj);
++ if (Index <= 0 || static_cast<uint32_t>(Index - 1) >= Sections.size())
++ return make_error<StringError>("Unexpected associative section index",
++ object_error::parse_failed);
++ Sym.AssociativeComdatTargetSectionId = Sections[Index - 1].UniqueId;
++ }
+ I += 1 + SymRef.getNumberOfAuxSymbols();
+ }
+ Obj.addSymbols(Symbols);
+@@ -116,7 +141,7 @@ Error COFFReader::setRelocTargets(Object &Obj) const {
+ for (size_t I = 0; I < Sym.Sym.NumberOfAuxSymbols; I++)
+ RawSymbolTable.push_back(nullptr);
+ }
+- for (Section &Sec : Obj.Sections) {
++ for (Section &Sec : Obj.getMutableSections()) {
+ for (Relocation &R : Sec.Relocs) {
+ if (R.Reloc.SymbolTableIndex >= RawSymbolTable.size())
+ return make_error<StringError>("SymbolTableIndex out of range",
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+index c347810dd24..9fb7812672b 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+@@ -25,7 +25,7 @@ using namespace object;
+ using namespace COFF;
+
+ Error COFFWriter::finalizeRelocTargets() {
+- for (Section &Sec : Obj.Sections) {
++ for (Section &Sec : Obj.getMutableSections()) {
+ for (Relocation &R : Sec.Relocs) {
+ const Symbol *Sym = Obj.findSymbol(R.Target);
+ if (Sym == nullptr)
+@@ -39,8 +39,48 @@ Error COFFWriter::finalizeRelocTargets() {
+ return Error::success();
+ }
+
++Error COFFWriter::finalizeSectionNumbers() {
++ for (Symbol &Sym : Obj.getMutableSymbols()) {
++ if (Sym.TargetSectionId <= 0) {
++ // Undefined, or a special kind of symbol. These negative values
++ // are stored in the SectionNumber field which is unsigned.
++ Sym.Sym.SectionNumber = static_cast<uint32_t>(Sym.TargetSectionId);
++ } else {
++ const Section *Sec = Obj.findSection(Sym.TargetSectionId);
++ if (Sec == nullptr)
++ return make_error<StringError>("Symbol " + Sym.Name +
++ " points to a removed section",
++ object_error::invalid_symbol_index);
++ Sym.Sym.SectionNumber = Sec->Index;
++
++ if (Sym.Sym.NumberOfAuxSymbols == 1 &&
++ Sym.Sym.StorageClass == IMAGE_SYM_CLASS_STATIC) {
++ coff_aux_section_definition *SD =
++ reinterpret_cast<coff_aux_section_definition *>(Sym.AuxData.data());
++ uint32_t SDSectionNumber;
++ if (Sym.AssociativeComdatTargetSectionId == 0) {
++ // Not a comdat associative section; just set the Number field to
++ // the number of the section itself.
++ SDSectionNumber = Sec->Index;
++ } else {
++ Sec = Obj.findSection(Sym.AssociativeComdatTargetSectionId);
++ if (Sec == nullptr)
++ return make_error<StringError>(
++ "Symbol " + Sym.Name + " is associative to a removed section",
++ object_error::invalid_symbol_index);
++ SDSectionNumber = Sec->Index;
++ }
++ // Update the section definition with the new section number.
++ SD->NumberLowPart = static_cast<uint16_t>(SDSectionNumber);
++ SD->NumberHighPart = static_cast<uint16_t>(SDSectionNumber >> 16);
++ }
++ }
++ }
++ return Error::success();
++}
++
+ void COFFWriter::layoutSections() {
+- for (auto &S : Obj.Sections) {
++ for (auto &S : Obj.getMutableSections()) {
+ if (S.Header.SizeOfRawData > 0)
+ S.Header.PointerToRawData = FileSize;
+ FileSize += S.Header.SizeOfRawData; // For executables, this is already
+@@ -57,7 +97,7 @@ void COFFWriter::layoutSections() {
+ }
+
+ size_t COFFWriter::finalizeStringTable() {
+- for (auto &S : Obj.Sections)
++ for (const auto &S : Obj.getSections())
+ if (S.Name.size() > COFF::NameSize)
+ StrTabBuilder.add(S.Name);
+
+@@ -67,7 +107,7 @@ size_t COFFWriter::finalizeStringTable() {
+
+ StrTabBuilder.finalize();
+
+- for (auto &S : Obj.Sections) {
++ for (auto &S : Obj.getMutableSections()) {
+ if (S.Name.size() > COFF::NameSize) {
+ snprintf(S.Header.Name, sizeof(S.Header.Name), "/%d",
+ (int)StrTabBuilder.getOffset(S.Name));
+@@ -97,6 +137,8 @@ std::pair<size_t, size_t> COFFWriter::finalizeSymbolTable() {
+ Error COFFWriter::finalize(bool IsBigObj) {
+ if (Error E = finalizeRelocTargets())
+ return E;
++ if (Error E = finalizeSectionNumbers())
++ return E;
+
+ size_t SizeOfHeaders = 0;
+ FileAlignment = 1;
+@@ -113,10 +155,10 @@ Error COFFWriter::finalize(bool IsBigObj) {
+ SizeOfHeaders +=
+ PeHeaderSize + sizeof(data_directory) * Obj.DataDirectories.size();
+ }
+- Obj.CoffFileHeader.NumberOfSections = Obj.Sections.size();
++ Obj.CoffFileHeader.NumberOfSections = Obj.getSections().size();
+ SizeOfHeaders +=
+ IsBigObj ? sizeof(coff_bigobj_file_header) : sizeof(coff_file_header);
+- SizeOfHeaders += sizeof(coff_section) * Obj.Sections.size();
++ SizeOfHeaders += sizeof(coff_section) * Obj.getSections().size();
+ SizeOfHeaders = alignTo(SizeOfHeaders, FileAlignment);
+
+ Obj.CoffFileHeader.SizeOfOptionalHeader =
+@@ -131,8 +173,8 @@ Error COFFWriter::finalize(bool IsBigObj) {
+ Obj.PeHeader.SizeOfHeaders = SizeOfHeaders;
+ Obj.PeHeader.SizeOfInitializedData = SizeOfInitializedData;
+
+- if (!Obj.Sections.empty()) {
+- const Section &S = Obj.Sections.back();
++ if (!Obj.getSections().empty()) {
++ const Section &S = Obj.getSections().back();
+ Obj.PeHeader.SizeOfImage =
+ alignTo(S.Header.VirtualAddress + S.Header.VirtualSize,
+ Obj.PeHeader.SectionAlignment);
+@@ -198,7 +240,7 @@ void COFFWriter::writeHeaders(bool IsBigObj) {
+ BigObjHeader.unused4 = 0;
+ // The value in Obj.CoffFileHeader.NumberOfSections is truncated, thus
+ // get the original one instead.
+- BigObjHeader.NumberOfSections = Obj.Sections.size();
++ BigObjHeader.NumberOfSections = Obj.getSections().size();
+ BigObjHeader.PointerToSymbolTable = Obj.CoffFileHeader.PointerToSymbolTable;
+ BigObjHeader.NumberOfSymbols = Obj.CoffFileHeader.NumberOfSymbols;
+
+@@ -223,14 +265,14 @@ void COFFWriter::writeHeaders(bool IsBigObj) {
+ Ptr += sizeof(DD);
+ }
+ }
+- for (const auto &S : Obj.Sections) {
++ for (const auto &S : Obj.getSections()) {
+ memcpy(Ptr, &S.Header, sizeof(S.Header));
+ Ptr += sizeof(S.Header);
+ }
+ }
+
+ void COFFWriter::writeSections() {
+- for (const auto &S : Obj.Sections) {
++ for (const auto &S : Obj.getSections()) {
+ uint8_t *Ptr = Buf.getBufferStart() + S.Header.PointerToRawData;
+ std::copy(S.Contents.begin(), S.Contents.end(), Ptr);
+
+@@ -295,7 +337,7 @@ Error COFFWriter::patchDebugDirectory() {
+ const data_directory *Dir = &Obj.DataDirectories[DEBUG_DIRECTORY];
+ if (Dir->Size <= 0)
+ return Error::success();
+- for (const auto &S : Obj.Sections) {
++ for (const auto &S : Obj.getSections()) {
+ if (Dir->RelativeVirtualAddress >= S.Header.VirtualAddress &&
+ Dir->RelativeVirtualAddress <
+ S.Header.VirtualAddress + S.Header.SizeOfRawData) {
+@@ -324,7 +366,7 @@ Error COFFWriter::patchDebugDirectory() {
+ }
+
+ Error COFFWriter::write() {
+- bool IsBigObj = Obj.Sections.size() > MaxNumberOfSections16;
++ bool IsBigObj = Obj.getSections().size() > MaxNumberOfSections16;
+ if (IsBigObj && Obj.IsPE)
+ return make_error<StringError>("Too many sections for executable",
+ object_error::parse_failed);
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.h b/llvm/tools/llvm-objcopy/COFF/Writer.h
+index 52fef385926..a967a103df9 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.h
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.h
+@@ -31,6 +31,7 @@ class COFFWriter {
+ StringTableBuilder StrTabBuilder;
+
+ Error finalizeRelocTargets();
++ Error finalizeSectionNumbers();
+ void layoutSections();
+ size_t finalizeStringTable();
+ template <class SymbolTy> std::pair<size_t, size_t> finalizeSymbolTable();
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-3.patch b/projects/clang/win-patches/llvm-objcopy-3.patch
new file mode 100644
index 0000000..6e303c0
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-3.patch
@@ -0,0 +1,160 @@
+From 2b6e1b7585d6bd997ea4e4233c904a6d2c11ad33 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Sat, 19 Jan 2019 19:42:41 +0000
+Subject: [PATCH] [llvm-objcopy] [COFF] Implement --strip-debug
+
+Also remove sections similarly for --strip-all, --discard-all,
+--strip-unneeded.
+
+Differential Revision: https://reviews.llvm.org/D56839
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351661 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ test/tools/llvm-objcopy/COFF/strip-debug.test | 109 ++++++++++++++++++
+ tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 11 ++
+ 2 files changed, 120 insertions(+)
+ create mode 100644 test/tools/llvm-objcopy/COFF/strip-debug.test
+
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/strip-debug.test b/llvm/test/tools/llvm-objcopy/COFF/strip-debug.test
+new file mode 100644
+index 00000000000..97fa96aac70
+--- /dev/null
++++ b/llvm/test/tools/llvm-objcopy/COFF/strip-debug.test
+@@ -0,0 +1,109 @@
++# RUN: yaml2obj %s > %t.in.o
++#
++# RUN: llvm-objdump --section-headers %t.in.o | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-PRE
++# RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE
++#
++# RUN: llvm-objcopy --strip-debug %t.in.o %t.out.o
++# RUN: llvm-objdump --section-headers %t.out.o | FileCheck %s --check-prefixes=SECTIONS
++# RUN: llvm-objdump -t %t.out.o | FileCheck %s --check-prefixes=SYMBOLS
++#
++# Test that --strip-all, --strip-all-gnu, --discard-all and --strip-unneeded,
++# plus llvm-strip without arguments all produce a similiar set of sections
++# (while they remove symbols differently).
++#
++# RUN: llvm-objcopy --strip-all %t.in.o %t.strip-all.o
++# RUN: llvm-objdump --section-headers %t.strip-all.o | FileCheck %s --check-prefixes=SECTIONS
++#
++# RUN: llvm-objcopy --strip-all-gnu %t.in.o %t.strip-all-gnu.o
++# RUN: llvm-objdump --section-headers %t.strip-all-gnu.o | FileCheck %s --check-prefixes=SECTIONS
++#
++# RUN: llvm-objcopy --discard-all %t.in.o %t.discard-all.o
++# RUN: llvm-objdump --section-headers %t.discard-all.o | FileCheck %s --check-prefixes=SECTIONS
++#
++# RUN: llvm-objcopy --discard-all %t.in.o %t.strip-unneeded.o
++# RUN: llvm-objdump --section-headers %t.strip-unneeded.o | FileCheck %s --check-prefixes=SECTIONS
++#
++# SECTIONS: Sections:
++# SECTIONS-NEXT: Idx Name
++# SECTIONS-NEXT: 0 .text
++# SECTIONS-NEXT: 1 .data
++# SECTIONS-NEXT: 2 .bss
++# SECTIONS-NEXT: 3 .xdata
++# SECTIONS-NEXT: 4 .reloc
++# SECTIONS-PRE-NEXT: 5 .debug_discardable
++# SECTIONS-NEXT: {{.*}} .debug_undiscardable
++# SECTIONS-NEXT: {{.*}} .llvm_addrsig
++# SECTIONS-EMPTY:
++#
++# Test that --strip-debug doesn't remove e.g. unreferenced local symbols.
++#
++# SYMBOLS: SYMBOL TABLE:
++# SYMBOLS-NEXT: external
++# SYMBOLS-NEXT: local_unreferenced
++# SYMBOLS-PRE-NEXT: debug_discardable_sym
++# SYMBOLS-NEXT: debug_undiscardable_sym
++# SYMBOLS-EMPTY:
++
++--- !COFF
++header:
++ Machine: IMAGE_FILE_MACHINE_AMD64
++ Characteristics: [ ]
++sections:
++ - Name: .text
++ Characteristics: [ ]
++ Alignment: 4
++ SectionData: 00000000
++ - Name: .data
++ Characteristics: [ ]
++ Alignment: 4
++ SectionData: 00000000
++ - Name: .bss
++ Characteristics: [ ]
++ Alignment: 4
++ SectionData: 00000000
++ - Name: .xdata
++ Characteristics: [ ]
++ Alignment: 4
++ SectionData: 00000000
++ - Name: .reloc
++ Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ]
++ Alignment: 4
++ SectionData: 00000000
++ - Name: .debug_discardable
++ Characteristics: [ IMAGE_SCN_MEM_DISCARDABLE ]
++ Alignment: 4
++ SectionData: 00000000
++ - Name: .debug_undiscardable
++ Characteristics: [ ]
++ Alignment: 4
++ SectionData: 00000000
++ - Name: .llvm_addrsig
++ Characteristics: [ IMAGE_SCN_LNK_REMOVE ]
++ Alignment: 4
++ SectionData: 00000000
++symbols:
++ - Name: external
++ Value: 0
++ SectionNumber: 1
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++ - Name: local_unreferenced
++ Value: 0
++ SectionNumber: 1
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_STATIC
++ - Name: debug_discardable_sym
++ Value: 0
++ SectionNumber: 6
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++ - Name: debug_undiscardable_sym
++ Value: 0
++ SectionNumber: 7
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++...
+diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+index dd2e4829218..13d8efde37c 100644
+--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+@@ -26,9 +26,20 @@ namespace coff {
+ using namespace object;
+ using namespace COFF;
+
++static bool isDebugSection(const Section &Sec) {
++ return Sec.Name.startswith(".debug");
++}
++
+ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
+ // Perform the actual section removals.
+ Obj.removeSections([&Config](const Section &Sec) {
++ if (Config.StripDebug || Config.StripAll || Config.StripAllGNU ||
++ Config.DiscardAll || Config.StripUnneeded) {
++ if (isDebugSection(Sec) &&
++ (Sec.Header.Characteristics & IMAGE_SCN_MEM_DISCARDABLE) != 0)
++ return true;
++ }
++
+ if (is_contained(Config.ToRemove, Sec.Name))
+ return true;
+
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-4.patch b/projects/clang/win-patches/llvm-objcopy-4.patch
new file mode 100644
index 0000000..e922384
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-4.patch
@@ -0,0 +1,222 @@
+From 526aa2e94355b7feb3bf7774a6e1899f68e94ad8 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Sat, 19 Jan 2019 19:42:48 +0000
+Subject: [PATCH] [llvm-objcopy] [COFF] Implement --only-keep-debug
+
+Differential Revision: https://reviews.llvm.org/D56840
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351662 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ .../COFF/Inputs/only-keep-sections.yaml | 77 +++++++++++++++++++
+ .../llvm-objcopy/COFF/only-keep-debug.test | 58 ++++++++++++++
+ tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 10 +++
+ tools/llvm-objcopy/COFF/Object.cpp | 10 +++
+ tools/llvm-objcopy/COFF/Object.h | 1 +
+ 5 files changed, 156 insertions(+)
+ create mode 100644 test/tools/llvm-objcopy/COFF/Inputs/only-keep-sections.yaml
+ create mode 100644 test/tools/llvm-objcopy/COFF/only-keep-debug.test
+
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/Inputs/only-keep-sections.yaml b/llvm/test/tools/llvm-objcopy/COFF/Inputs/only-keep-sections.yaml
+new file mode 100644
+index 00000000000..b5437e10763
+--- /dev/null
++++ b/llvm/test/tools/llvm-objcopy/COFF/Inputs/only-keep-sections.yaml
+@@ -0,0 +1,77 @@
++--- !COFF
++OptionalHeader:
++ AddressOfEntryPoint: 4144
++ ImageBase: 1073741824
++ SectionAlignment: 4096
++ FileAlignment: 512
++ MajorOperatingSystemVersion: 6
++ MinorOperatingSystemVersion: 0
++ MajorImageVersion: 0
++ MinorImageVersion: 0
++ MajorSubsystemVersion: 6
++ MinorSubsystemVersion: 0
++ Subsystem: IMAGE_SUBSYSTEM_WINDOWS_CUI
++ DLLCharacteristics: [ ]
++ SizeOfStackReserve: 1048576
++ SizeOfStackCommit: 4096
++ SizeOfHeapReserve: 1048576
++ SizeOfHeapCommit: 4096
++header:
++ Machine: IMAGE_FILE_MACHINE_AMD64
++ Characteristics: [ ]
++sections:
++ - Name: .text
++ Characteristics: [ IMAGE_SCN_CNT_CODE ]
++ VirtualAddress: 4096
++ VirtualSize: 4
++ SectionData: C3C3C3C3
++ - Name: .rdata
++ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA ]
++ VirtualAddress: 8192
++ VirtualSize: 4
++ SectionData: 2A000000
++ - Name: .buildid
++ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA ]
++ VirtualAddress: 12288
++ VirtualSize: 4
++ SectionData: 2B000000
++ - Name: .reloc
++ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE ]
++ VirtualAddress: 16384
++ VirtualSize: 4
++ SectionData: 2C000000
++ - Name: .debug_discardable
++ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE ]
++ VirtualAddress: 20480
++ VirtualSize: 4
++ SectionData: 2D000000
++ - Name: .debug_undiscardable
++ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA ]
++ VirtualAddress: 24576
++ VirtualSize: 4
++ SectionData: 2E000000
++ - Name: .unflagged
++ Characteristics: [ ]
++ VirtualAddress: 28672
++ VirtualSize: 4
++ SectionData: 2F000000
++symbols:
++ - Name: main
++ Value: 2
++ SectionNumber: 1
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++ - Name: debug_discardable_sym
++ Value: 0
++ SectionNumber: 5
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++ - Name: debug_undiscardable_sym
++ Value: 0
++ SectionNumber: 6
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++...
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/only-keep-debug.test b/llvm/test/tools/llvm-objcopy/COFF/only-keep-debug.test
+new file mode 100644
+index 00000000000..5518d4000fc
+--- /dev/null
++++ b/llvm/test/tools/llvm-objcopy/COFF/only-keep-debug.test
+@@ -0,0 +1,58 @@
++RUN: yaml2obj %p/Inputs/only-keep-sections.yaml > %t.in.exe
++
++RUN: llvm-objcopy --only-keep-debug %t.in.exe %t.out.exe
++RUN: llvm-readobj --sections %t.out.exe | FileCheck %s --check-prefix=SECTIONS
++RUN: llvm-objdump -t %t.out.exe | FileCheck %s --check-prefix=SYMBOLS
++
++Check that all non-debug/buildid sections with IMAGE_SCN_CNT_CODE
++or IMAGE_SCN_CNT_INITIALIZED_DATA are truncated, and no others.
++
++SECTIONS: Sections [
++SECTIONS-NEXT: Section {
++SECTIONS-NEXT: Number: 1
++SECTIONS-NEXT: Name: .text
++SECTIONS-NEXT: VirtualSize: 0x4
++SECTIONS-NEXT: VirtualAddress:
++SECTIONS-NEXT: RawDataSize: 0
++SECTIONS: Section {
++SECTIONS-NEXT: Number: 2
++SECTIONS-NEXT: Name: .rdata
++SECTIONS-NEXT: VirtualSize: 0x4
++SECTIONS-NEXT: VirtualAddress:
++SECTIONS-NEXT: RawDataSize: 0
++SECTIONS: Section {
++SECTIONS-NEXT: Number: 3
++SECTIONS-NEXT: Name: .buildid
++SECTIONS-NEXT: VirtualSize: 0x4
++SECTIONS-NEXT: VirtualAddress:
++SECTIONS-NEXT: RawDataSize: 512
++SECTIONS: Section {
++SECTIONS-NEXT: Number: 4
++SECTIONS-NEXT: Name: .reloc
++SECTIONS-NEXT: VirtualSize: 0x4
++SECTIONS-NEXT: VirtualAddress:
++SECTIONS-NEXT: RawDataSize: 0
++SECTIONS: Section {
++SECTIONS-NEXT: Number: 5
++SECTIONS-NEXT: Name: .debug_discardable
++SECTIONS-NEXT: VirtualSize: 0x4
++SECTIONS-NEXT: VirtualAddress:
++SECTIONS-NEXT: RawDataSize: 512
++SECTIONS: Section {
++SECTIONS-NEXT: Number: 6
++SECTIONS-NEXT: Name: .debug_undiscardable
++SECTIONS-NEXT: VirtualSize: 0x4
++SECTIONS-NEXT: VirtualAddress:
++SECTIONS-NEXT: RawDataSize: 512
++SECTIONS: Section {
++SECTIONS-NEXT: Number: 7
++SECTIONS-NEXT: Name: .unflagged
++SECTIONS-NEXT: VirtualSize: 0x4
++SECTIONS-NEXT: VirtualAddress:
++SECTIONS-NEXT: RawDataSize: 512
++
++SYMBOLS: SYMBOL TABLE:
++SYMBOLS-NEXT: main
++SYMBOLS-NEXT: debug_discardable_sym
++SYMBOLS-NEXT: debug_undiscardable_sym
++SYMBOLS-EMPTY:
+diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+index 13d8efde37c..60afbf7bb54 100644
+--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+@@ -46,6 +46,16 @@ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
+ return false;
+ });
+
++ if (Config.OnlyKeepDebug) {
++ // For --only-keep-debug, we keep all other sections, but remove their
++ // content. The VirtualSize field in the section header is kept intact.
++ Obj.truncateSections([](const Section &Sec) {
++ return !isDebugSection(Sec) && Sec.Name != ".buildid" &&
++ ((Sec.Header.Characteristics &
++ (IMAGE_SCN_CNT_CODE | IMAGE_SCN_CNT_INITIALIZED_DATA)) != 0);
++ });
++ }
++
+ // StripAll removes all symbols and thus also removes all relocations.
+ if (Config.StripAll || Config.StripAllGNU)
+ for (Section &Sec : Obj.getMutableSections())
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.cpp b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+index e19cea6aa9d..fc87d9e574d 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+@@ -127,6 +127,16 @@ void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
+ updateSymbols();
+ }
+
++void Object::truncateSections(function_ref<bool(const Section &)> ToTruncate) {
++ for (Section &Sec : Sections) {
++ if (ToTruncate(Sec)) {
++ Sec.Contents = ArrayRef<uint8_t>();
++ Sec.Relocs.clear();
++ Sec.Header.SizeOfRawData = 0;
++ }
++ }
++}
++
+ } // end namespace coff
+ } // end namespace objcopy
+ } // end namespace llvm
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.h b/llvm/tools/llvm-objcopy/COFF/Object.h
+index a73e93620d3..8e200369f0b 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.h
++++ b/llvm/tools/llvm-objcopy/COFF/Object.h
+@@ -93,6 +93,7 @@ struct Object {
+
+ void addSections(ArrayRef<Section> NewSections);
+ void removeSections(function_ref<bool(const Section &)> ToRemove);
++ void truncateSections(function_ref<bool(const Section &)> ToTruncate);
+
+ private:
+ std::vector<Symbol> Symbols;
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-5.patch b/projects/clang/win-patches/llvm-objcopy-5.patch
new file mode 100644
index 0000000..657c72a
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-5.patch
@@ -0,0 +1,61 @@
+From 17dcf25b3ade15605ca27150e4440bcc75caed65 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Sat, 19 Jan 2019 19:42:54 +0000
+Subject: [PATCH] [llvm-objcopy] [COFF] Implement --only-section
+
+Differential Revision: https://reviews.llvm.org/D56873
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351663 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ .../tools/llvm-objcopy/COFF/only-section.test | 21 +++++++++++++++++++
+ tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 6 ++++++
+ 2 files changed, 27 insertions(+)
+ create mode 100644 test/tools/llvm-objcopy/COFF/only-section.test
+
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/only-section.test b/llvm/test/tools/llvm-objcopy/COFF/only-section.test
+new file mode 100644
+index 00000000000..42492ed80ff
+--- /dev/null
++++ b/llvm/test/tools/llvm-objcopy/COFF/only-section.test
+@@ -0,0 +1,21 @@
++RUN: yaml2obj %p/Inputs/only-keep-sections.yaml > %t.in.exe
++
++RUN: llvm-objcopy --only-section .debug_discardable %t.in.exe %t.out.exe
++RUN: llvm-objdump --section-headers -t %t.out.exe | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-DEBUG,SYMBOLS,SYMBOLS-DEBUG
++
++Adding another section stripping option makes it return the intersection of
++kept sections - in this case keeping only .text.
++
++RUN: llvm-objcopy --only-section .debug_discardable --only-section .text --strip-debug %t.in.exe %t.combination.exe
++RUN: llvm-objdump --section-headers -t %t.combination.exe | FileCheck %s --check-prefixes=SECTIONS,SECTIONS-TEXT,SYMBOLS,SYMBOLS-TEXT
++
++SECTIONS: Sections:
++SECTIONS-NEXT: Idx Name
++SECTIONS-DEBUG-NEXT: .debug_discardable
++SECTIONS-TEXT-NEXT: .text
++SECTIONS-EMPTY:
++
++SYMBOLS: SYMBOL TABLE:
++SYMBOLS-DEBUG-NEXT: debug_discardable_sym
++SYMBOLS-TEXT-NEXT: main
++SYMBOLS-EMPTY:
+diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+index 60afbf7bb54..99929d10a1f 100644
+--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+@@ -33,6 +33,12 @@ static bool isDebugSection(const Section &Sec) {
+ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
+ // Perform the actual section removals.
+ Obj.removeSections([&Config](const Section &Sec) {
++ // Contrary to --only-keep-debug, --only-section fully removes sections that
++ // aren't mentioned.
++ if (!Config.OnlySection.empty() &&
++ !is_contained(Config.OnlySection, Sec.Name))
++ return true;
++
+ if (Config.StripDebug || Config.StripAll || Config.StripAllGNU ||
+ Config.DiscardAll || Config.StripUnneeded) {
+ if (isDebugSection(Sec) &&
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-6.patch b/projects/clang/win-patches/llvm-objcopy-6.patch
new file mode 100644
index 0000000..e70f1b9
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-6.patch
@@ -0,0 +1,242 @@
+From d3b89a1637cddee1c61e59257cfe92227ead29e5 Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Tue, 22 Jan 2019 10:57:59 +0000
+Subject: [PATCH] [llvm-objcopy] Consistently use createStringError instead of
+ make_error<StringError>
+
+This was requested in the review of D57006.
+
+Also add missing quotes around symbol names in error messages.
+
+Differential Revision: https://reviews.llvm.org/D57014
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351799 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ .../llvm-objcopy/COFF/remove-section.test | 2 +-
+ tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 8 ++---
+ tools/llvm-objcopy/COFF/Object.cpp | 5 ++-
+ tools/llvm-objcopy/COFF/Reader.cpp | 24 +++++++-------
+ tools/llvm-objcopy/COFF/Writer.cpp | 33 +++++++++----------
+ tools/llvm-objcopy/ELF/ELFObjcopy.cpp | 10 +++---
+ 6 files changed, 40 insertions(+), 42 deletions(-)
+
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/remove-section.test b/llvm/test/tools/llvm-objcopy/COFF/remove-section.test
+index b3dfb0b98cb..6dc8f6a6c2e 100644
+--- a/llvm/test/tools/llvm-objcopy/COFF/remove-section.test
++++ b/llvm/test/tools/llvm-objcopy/COFF/remove-section.test
+@@ -96,7 +96,7 @@
+ # Removing the .comdat section fails, since the .text section has relocations
+ # against it.
+ #
+-# ERROR-RELOC: Relocation target foo ({{.*}}) not found
++# ERROR-RELOC: Relocation target 'foo' ({{.*}}) not found
+ #
+ #
+ # Removing the .comdat section and .text (with a relocation against .comdat)
+diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+index 99929d10a1f..8d8f53d13d8 100644
+--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+@@ -84,10 +84,10 @@ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
+ // Explicitly removing a referenced symbol is an error.
+ if (Sym.Referenced)
+ reportError(Config.OutputFilename,
+- make_error<StringError>(
+- "not stripping symbol '" + Sym.Name +
+- "' because it is named in a relocation.",
+- llvm::errc::invalid_argument));
++ createStringError(llvm::errc::invalid_argument,
++ "not stripping symbol '%s' because it is "
++ "named in a relocation.",
++ Sym.Name.str().c_str()));
+ return true;
+ }
+
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.cpp b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+index fc87d9e574d..83435dffa98 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+@@ -56,9 +56,8 @@ Error Object::markSymbols() {
+ for (const Relocation &R : Sec.Relocs) {
+ auto It = SymbolMap.find(R.Target);
+ if (It == SymbolMap.end())
+- return make_error<StringError>("Relocation target " + Twine(R.Target) +
+- " not found",
+- object_error::invalid_symbol_index);
++ return createStringError(object_error::invalid_symbol_index,
++ "Relocation target %zu not found", R.Target);
+ It->second->Referenced = true;
+ }
+ }
+diff --git a/llvm/tools/llvm-objcopy/COFF/Reader.cpp b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+index c8abe2913a2..20ff32a59dc 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Reader.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+@@ -77,8 +77,8 @@ Error COFFReader::readSections(Object &Obj) const {
+ if (auto EC = COFFObj.getSectionName(Sec, S.Name))
+ return errorCodeToError(EC);
+ if (Sec->hasExtendedRelocations())
+- return make_error<StringError>("Extended relocations not supported yet",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed,
++ "Extended relocations not supported yet");
+ }
+ Obj.addSections(Sections);
+ return Error::success();
+@@ -116,16 +116,16 @@ Error COFFReader::readSymbols(Object &Obj, bool IsBigObj) const {
+ Sections.size())
+ Sym.TargetSectionId = Sections[SymRef.getSectionNumber() - 1].UniqueId;
+ else
+- return make_error<StringError>("Section number out of range",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed,
++ "Section number out of range");
+ // For section definitions, check if it is comdat associative, and if
+ // it is, find the target section unique id.
+ const coff_aux_section_definition *SD = SymRef.getSectionDefinition();
+ if (SD && SD->Selection == IMAGE_COMDAT_SELECT_ASSOCIATIVE) {
+ int32_t Index = SD->getNumber(IsBigObj);
+ if (Index <= 0 || static_cast<uint32_t>(Index - 1) >= Sections.size())
+- return make_error<StringError>("Unexpected associative section index",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed,
++ "Unexpected associative section index");
+ Sym.AssociativeComdatTargetSectionId = Sections[Index - 1].UniqueId;
+ }
+ I += 1 + SymRef.getNumberOfAuxSymbols();
+@@ -144,12 +144,12 @@ Error COFFReader::setRelocTargets(Object &Obj) const {
+ for (Section &Sec : Obj.getMutableSections()) {
+ for (Relocation &R : Sec.Relocs) {
+ if (R.Reloc.SymbolTableIndex >= RawSymbolTable.size())
+- return make_error<StringError>("SymbolTableIndex out of range",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed,
++ "SymbolTableIndex out of range");
+ const Symbol *Sym = RawSymbolTable[R.Reloc.SymbolTableIndex];
+ if (Sym == nullptr)
+- return make_error<StringError>("Invalid SymbolTableIndex",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed,
++ "Invalid SymbolTableIndex");
+ R.Target = Sym->UniqueId;
+ R.TargetName = Sym->Name;
+ }
+@@ -169,8 +169,8 @@ Expected<std::unique_ptr<Object>> COFFReader::create() const {
+ Obj->CoffFileHeader = *CFH;
+ } else {
+ if (!CBFH)
+- return make_error<StringError>("No COFF file header returned",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed,
++ "No COFF file header returned");
+ // Only copying the few fields from the bigobj header that we need
+ // and won't recreate in the end.
+ Obj->CoffFileHeader.Machine = CBFH->Machine;
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+index 9fb7812672b..0321f94a896 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+@@ -29,10 +29,9 @@ Error COFFWriter::finalizeRelocTargets() {
+ for (Relocation &R : Sec.Relocs) {
+ const Symbol *Sym = Obj.findSymbol(R.Target);
+ if (Sym == nullptr)
+- return make_error<StringError>("Relocation target " + R.TargetName +
+- " (" + Twine(R.Target) +
+- ") not found",
+- object_error::invalid_symbol_index);
++ return createStringError(object_error::invalid_symbol_index,
++ "Relocation target '%s' (%zu) not found",
++ R.TargetName.str().c_str(), R.Target);
+ R.Reloc.SymbolTableIndex = Sym->RawIndex;
+ }
+ }
+@@ -48,9 +47,9 @@ Error COFFWriter::finalizeSectionNumbers() {
+ } else {
+ const Section *Sec = Obj.findSection(Sym.TargetSectionId);
+ if (Sec == nullptr)
+- return make_error<StringError>("Symbol " + Sym.Name +
+- " points to a removed section",
+- object_error::invalid_symbol_index);
++ return createStringError(object_error::invalid_symbol_index,
++ "Symbol '%s' points to a removed section",
++ Sym.Name.str().c_str());
+ Sym.Sym.SectionNumber = Sec->Index;
+
+ if (Sym.Sym.NumberOfAuxSymbols == 1 &&
+@@ -65,9 +64,10 @@ Error COFFWriter::finalizeSectionNumbers() {
+ } else {
+ Sec = Obj.findSection(Sym.AssociativeComdatTargetSectionId);
+ if (Sec == nullptr)
+- return make_error<StringError>(
+- "Symbol " + Sym.Name + " is associative to a removed section",
+- object_error::invalid_symbol_index);
++ return createStringError(
++ object_error::invalid_symbol_index,
++ "Symbol '%s' is associative to a removed section",
++ Sym.Name.str().c_str());
+ SDSectionNumber = Sec->Index;
+ }
+ // Update the section definition with the new section number.
+@@ -343,9 +343,8 @@ Error COFFWriter::patchDebugDirectory() {
+ S.Header.VirtualAddress + S.Header.SizeOfRawData) {
+ if (Dir->RelativeVirtualAddress + Dir->Size >
+ S.Header.VirtualAddress + S.Header.SizeOfRawData)
+- return make_error<StringError>(
+- "Debug directory extends past end of section",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed,
++ "Debug directory extends past end of section");
+
+ size_t Offset = Dir->RelativeVirtualAddress - S.Header.VirtualAddress;
+ uint8_t *Ptr = Buf.getBufferStart() + S.Header.PointerToRawData + Offset;
+@@ -361,15 +360,15 @@ Error COFFWriter::patchDebugDirectory() {
+ return Error::success();
+ }
+ }
+- return make_error<StringError>("Debug directory not found",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed,
++ "Debug directory not found");
+ }
+
+ Error COFFWriter::write() {
+ bool IsBigObj = Obj.getSections().size() > MaxNumberOfSections16;
+ if (IsBigObj && Obj.IsPE)
+- return make_error<StringError>("Too many sections for executable",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed,
++ "Too many sections for executable");
+ return write(IsBigObj);
+ }
+
+diff --git a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
+index db0cd76ced4..a2996395c1f 100644
+--- a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
+@@ -185,9 +185,10 @@ static Error dumpSectionToFile(StringRef SecName, StringRef Filename,
+ for (auto &Sec : Obj.sections()) {
+ if (Sec.Name == SecName) {
+ if (Sec.OriginalData.empty())
+- return make_error<StringError>("Can't dump section \"" + SecName +
+- "\": it has no contents",
+- object_error::parse_failed);
++ return createStringError(
++ object_error::parse_failed,
++ "Can't dump section \"%s\": it has no contents",
++ SecName.str().c_str());
+ Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
+ FileOutputBuffer::create(Filename, Sec.OriginalData.size());
+ if (!BufferOrErr)
+@@ -200,8 +201,7 @@ static Error dumpSectionToFile(StringRef SecName, StringRef Filename,
+ return Error::success();
+ }
+ }
+- return make_error<StringError>("Section not found",
+- object_error::parse_failed);
++ return createStringError(object_error::parse_failed, "Section not found");
+ }
+
+ static bool isCompressed(const SectionBase &Section) {
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-7.patch b/projects/clang/win-patches/llvm-objcopy-7.patch
new file mode 100644
index 0000000..80e9785
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-7.patch
@@ -0,0 +1,224 @@
+From d37f67c7311cd371d9ff1afd398bc92f309e6baf Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Tue, 22 Jan 2019 10:58:09 +0000
+Subject: [PATCH] [llvm-objcopy] [COFF] Update symbol indices in weak externals
+
+Differential Revision: https://reviews.llvm.org/D57006
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351800 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ .../llvm-objcopy/COFF/weak-external.test | 49 +++++++++++++++++++
+ tools/llvm-objcopy/COFF/Object.h | 2 +
+ tools/llvm-objcopy/COFF/Reader.cpp | 24 ++++++++-
+ tools/llvm-objcopy/COFF/Reader.h | 2 +-
+ tools/llvm-objcopy/COFF/Writer.cpp | 16 +++++-
+ tools/llvm-objcopy/COFF/Writer.h | 2 +-
+ 6 files changed, 89 insertions(+), 6 deletions(-)
+ create mode 100644 test/tools/llvm-objcopy/COFF/weak-external.test
+
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/weak-external.test b/llvm/test/tools/llvm-objcopy/COFF/weak-external.test
+new file mode 100644
+index 00000000000..d36a53b4eb1
+--- /dev/null
++++ b/llvm/test/tools/llvm-objcopy/COFF/weak-external.test
+@@ -0,0 +1,49 @@
++# RUN: yaml2obj %s > %t.in.o
++
++# RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE
++
++# RUN: llvm-objcopy -N func %t.in.o %t.out.o
++# RUN: llvm-objdump -t %t.out.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-POST
++
++# RUN: not llvm-objcopy -N .weak.foobar.file1 %t.in.o %t.err.o 2>&1 | FileCheck %s --check-prefix=ERROR
++
++# SYMBOLS: SYMBOL TABLE:
++# SYMBOLS-PRE-NEXT: func
++# SYMBOLS-NEXT: .weak.foobar.file1
++# SYMBOLS-NEXT: foobar
++# SYMBOLS-PRE-NEXT: AUX indx 1
++# SYMBOLS-POST-NEXT: AUX indx 0
++# SYMBOLS-EMPTY:
++
++# ERROR: Symbol 'foobar' is missing its weak target
++
++--- !COFF
++header:
++ Machine: IMAGE_FILE_MACHINE_AMD64
++ Characteristics: [ ]
++sections:
++ - Name: .text
++ Characteristics: [ ]
++symbols:
++ - Name: func
++ Value: 0
++ SectionNumber: 1
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++ - Name: .weak.foobar.file1
++ Value: 1
++ SectionNumber: 1
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_NULL
++ StorageClass: IMAGE_SYM_CLASS_EXTERNAL
++ - Name: foobar
++ Value: 0
++ SectionNumber: 0
++ SimpleType: IMAGE_SYM_TYPE_NULL
++ ComplexType: IMAGE_SYM_DTYPE_FUNCTION
++ StorageClass: IMAGE_SYM_CLASS_WEAK_EXTERNAL
++ WeakExternal:
++ TagIndex: 1
++ Characteristics: IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY
++...
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.h b/llvm/tools/llvm-objcopy/COFF/Object.h
+index 8e200369f0b..0630f9c5ff8 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.h
++++ b/llvm/tools/llvm-objcopy/COFF/Object.h
+@@ -11,6 +11,7 @@
+
+ #include "llvm/ADT/ArrayRef.h"
+ #include "llvm/ADT/DenseMap.h"
++#include "llvm/ADT/Optional.h"
+ #include "llvm/ADT/StringRef.h"
+ #include "llvm/ADT/iterator_range.h"
+ #include "llvm/BinaryFormat/COFF.h"
+@@ -47,6 +48,7 @@ struct Symbol {
+ std::vector<uint8_t> AuxData;
+ ssize_t TargetSectionId;
+ ssize_t AssociativeComdatTargetSectionId = 0;
++ Optional<size_t> WeakTargetSymbolId;
+ size_t UniqueId;
+ size_t RawIndex;
+ bool Referenced;
+diff --git a/llvm/tools/llvm-objcopy/COFF/Reader.cpp b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+index 20ff32a59dc..2446277cc2b 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Reader.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+@@ -121,12 +121,18 @@ Error COFFReader::readSymbols(Object &Obj, bool IsBigObj) const {
+ // For section definitions, check if it is comdat associative, and if
+ // it is, find the target section unique id.
+ const coff_aux_section_definition *SD = SymRef.getSectionDefinition();
++ const coff_aux_weak_external *WE = SymRef.getWeakExternal();
+ if (SD && SD->Selection == IMAGE_COMDAT_SELECT_ASSOCIATIVE) {
+ int32_t Index = SD->getNumber(IsBigObj);
+ if (Index <= 0 || static_cast<uint32_t>(Index - 1) >= Sections.size())
+ return createStringError(object_error::parse_failed,
+ "Unexpected associative section index");
+ Sym.AssociativeComdatTargetSectionId = Sections[Index - 1].UniqueId;
++ } else if (WE) {
++ // This is a raw symbol index for now, but store it in the Symbol
++ // until we've added them to the Object, which assigns the final
++ // unique ids.
++ Sym.WeakTargetSymbolId = WE->TagIndex;
+ }
+ I += 1 + SymRef.getNumberOfAuxSymbols();
+ }
+@@ -134,13 +140,27 @@ Error COFFReader::readSymbols(Object &Obj, bool IsBigObj) const {
+ return Error::success();
+ }
+
+-Error COFFReader::setRelocTargets(Object &Obj) const {
++Error COFFReader::setSymbolTargets(Object &Obj) const {
+ std::vector<const Symbol *> RawSymbolTable;
+ for (const Symbol &Sym : Obj.getSymbols()) {
+ RawSymbolTable.push_back(&Sym);
+ for (size_t I = 0; I < Sym.Sym.NumberOfAuxSymbols; I++)
+ RawSymbolTable.push_back(nullptr);
+ }
++ for (Symbol &Sym : Obj.getMutableSymbols()) {
++ // Convert WeakTargetSymbolId from the original raw symbol index to
++ // a proper unique id.
++ if (Sym.WeakTargetSymbolId) {
++ if (*Sym.WeakTargetSymbolId >= RawSymbolTable.size())
++ return createStringError(object_error::parse_failed,
++ "Weak external reference out of range");
++ const Symbol *Target = RawSymbolTable[*Sym.WeakTargetSymbolId];
++ if (Target == nullptr)
++ return createStringError(object_error::parse_failed,
++ "Invalid SymbolTableIndex");
++ Sym.WeakTargetSymbolId = Target->UniqueId;
++ }
++ }
+ for (Section &Sec : Obj.getMutableSections()) {
+ for (Relocation &R : Sec.Relocs) {
+ if (R.Reloc.SymbolTableIndex >= RawSymbolTable.size())
+@@ -184,7 +204,7 @@ Expected<std::unique_ptr<Object>> COFFReader::create() const {
+ return std::move(E);
+ if (Error E = readSymbols(*Obj, IsBigObj))
+ return std::move(E);
+- if (Error E = setRelocTargets(*Obj))
++ if (Error E = setSymbolTargets(*Obj))
+ return std::move(E);
+
+ return std::move(Obj);
+diff --git a/llvm/tools/llvm-objcopy/COFF/Reader.h b/llvm/tools/llvm-objcopy/COFF/Reader.h
+index 4493705e73c..ec15369db0b 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Reader.h
++++ b/llvm/tools/llvm-objcopy/COFF/Reader.h
+@@ -28,7 +28,7 @@ class COFFReader {
+ Error readExecutableHeaders(Object &Obj) const;
+ Error readSections(Object &Obj) const;
+ Error readSymbols(Object &Obj, bool IsBigObj) const;
+- Error setRelocTargets(Object &Obj) const;
++ Error setSymbolTargets(Object &Obj) const;
+
+ public:
+ explicit COFFReader(const COFFObjectFile &O) : COFFObj(O) {}
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+index 0321f94a896..4f57131d5ab 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+@@ -38,7 +38,7 @@ Error COFFWriter::finalizeRelocTargets() {
+ return Error::success();
+ }
+
+-Error COFFWriter::finalizeSectionNumbers() {
++Error COFFWriter::finalizeSymbolContents() {
+ for (Symbol &Sym : Obj.getMutableSymbols()) {
+ if (Sym.TargetSectionId <= 0) {
+ // Undefined, or a special kind of symbol. These negative values
+@@ -75,6 +75,18 @@ Error COFFWriter::finalizeSectionNumbers() {
+ SD->NumberHighPart = static_cast<uint16_t>(SDSectionNumber >> 16);
+ }
+ }
++ // Check that we actually have got AuxData to match the weak symbol target
++ // we want to set. Only >= 1 would be required, but only == 1 makes sense.
++ if (Sym.WeakTargetSymbolId && Sym.Sym.NumberOfAuxSymbols == 1) {
++ coff_aux_weak_external *WE =
++ reinterpret_cast<coff_aux_weak_external *>(Sym.AuxData.data());
++ const Symbol *Target = Obj.findSymbol(*Sym.WeakTargetSymbolId);
++ if (Target == nullptr)
++ return createStringError(object_error::invalid_symbol_index,
++ "Symbol '%s' is missing its weak target",
++ Sym.Name.str().c_str());
++ WE->TagIndex = Target->RawIndex;
++ }
+ }
+ return Error::success();
+ }
+@@ -137,7 +149,7 @@ std::pair<size_t, size_t> COFFWriter::finalizeSymbolTable() {
+ Error COFFWriter::finalize(bool IsBigObj) {
+ if (Error E = finalizeRelocTargets())
+ return E;
+- if (Error E = finalizeSectionNumbers())
++ if (Error E = finalizeSymbolContents())
+ return E;
+
+ size_t SizeOfHeaders = 0;
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.h b/llvm/tools/llvm-objcopy/COFF/Writer.h
+index a967a103df9..9b1cfa91d00 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.h
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.h
+@@ -31,7 +31,7 @@ class COFFWriter {
+ StringTableBuilder StrTabBuilder;
+
+ Error finalizeRelocTargets();
+- Error finalizeSectionNumbers();
++ Error finalizeSymbolContents();
+ void layoutSections();
+ size_t finalizeStringTable();
+ template <class SymbolTy> std::pair<size_t, size_t> finalizeSymbolTable();
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-8.patch b/projects/clang/win-patches/llvm-objcopy-8.patch
new file mode 100644
index 0000000..6fd9776
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-8.patch
@@ -0,0 +1,330 @@
+From 8cf7aa39d7c9461e2d765f6d4fa7e0925571695f Mon Sep 17 00:00:00 2001
+From: Jordan Rupprecht <rupprecht(a)google.com>
+Date: Tue, 22 Jan 2019 23:49:16 +0000
+Subject: [PATCH] [llvm-objcopy] Return Error from Buffer::allocate(),
+ [ELF]Writer::finalize(), and [ELF]Writer::commit()
+
+Summary:
+This patch changes a few methods to return Error instead of manually calling error/reportError to abort. This will make it easier to extract into a library.
+
+Note that error() takes just a string (this patch also adds an overload that takes an Error), while reportError() takes string + [error/code]. To help unify things, use FileError to associate a given filename with an error. Note that this takes some special care (for now), e.g. calling reportError(FileName, <something that could be FileError>) will duplicate the filename. The goal is to eventually remove reportError() and have every error associated with a file to be a FileError, and just one error handling block at the tool level.
+
+This change was suggested in D56806. I took it a little further than suggested, but completely fixing llvm-objcopy will take a couple more patches. If this approach looks good, I'll commit this and apply similar patche(s) for the rest.
+
+This change is NFC in terms of non-error related code, although the error message changes in one context.
+
+Reviewers: alexshap, jhenderson, jakehehrlich, mstorsjo, espindola
+
+Reviewed By: alexshap, jhenderson
+
+Subscribers: llvm-commits, emaste, arichardson
+
+Differential Revision: https://reviews.llvm.org/D56930
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351896 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ .../ELF/fail-no-output-directory.test | 2 +-
+ tools/llvm-objcopy/Buffer.cpp | 20 ++++++++++++-----
+ tools/llvm-objcopy/Buffer.h | 6 ++---
+ tools/llvm-objcopy/COFF/Writer.cpp | 3 ++-
+ tools/llvm-objcopy/ELF/ELFObjcopy.cpp | 18 ++++++++++-----
+ tools/llvm-objcopy/ELF/Object.cpp | 22 ++++++++++---------
+ tools/llvm-objcopy/ELF/Object.h | 12 +++++-----
+ tools/llvm-objcopy/llvm-objcopy.cpp | 15 +++++++++++--
+ tools/llvm-objcopy/llvm-objcopy.h | 1 +
+ 9 files changed, 64 insertions(+), 35 deletions(-)
+
+diff --git a/llvm/test/tools/llvm-objcopy/ELF/fail-no-output-directory.test b/llvm/test/tools/llvm-objcopy/ELF/fail-no-output-directory.test
+index f66b2e09fce..732046fa925 100644
+--- a/llvm/test/tools/llvm-objcopy/ELF/fail-no-output-directory.test
++++ b/llvm/test/tools/llvm-objcopy/ELF/fail-no-output-directory.test
+@@ -1,6 +1,6 @@
+ # RUN: yaml2obj %s > %t
+ # RUN: not llvm-objcopy %t no/such/dir 2>&1 | FileCheck %s
+-# CHECK: failed to open no/such/dir:
++# CHECK: error: 'no/such/dir': No such file or directory
+
+ !ELF
+ FileHeader:
+diff --git a/llvm/tools/llvm-objcopy/Buffer.cpp b/llvm/tools/llvm-objcopy/Buffer.cpp
+index 2da03dee1af..1789097f276 100644
+--- a/llvm/tools/llvm-objcopy/Buffer.cpp
++++ b/llvm/tools/llvm-objcopy/Buffer.cpp
+@@ -17,23 +17,31 @@ namespace objcopy {
+
+ Buffer::~Buffer() {}
+
+-void FileBuffer::allocate(size_t Size) {
++Error FileBuffer::allocate(size_t Size) {
+ Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
+ FileOutputBuffer::create(getName(), Size, FileOutputBuffer::F_executable);
+- handleAllErrors(BufferOrErr.takeError(), [this](const ErrorInfoBase &E) {
+- error("failed to open " + getName() + ": " + E.message());
+- });
++ // FileOutputBuffer::create() returns an Error that is just a wrapper around
++ // std::error_code. Wrap it in FileError to include the actual filename.
++ if (!BufferOrErr)
++ return createFileError(getName(), BufferOrErr.takeError());
+ Buf = std::move(*BufferOrErr);
++ return Error::success();
+ }
+
+-Error FileBuffer::commit() { return Buf->commit(); }
++Error FileBuffer::commit() {
++ Error Err = Buf->commit();
++ // FileOutputBuffer::commit() returns an Error that is just a wrapper around
++ // std::error_code. Wrap it in FileError to include the actual filename.
++ return Err ? createFileError(getName(), std::move(Err)) : std::move(Err);
++}
+
+ uint8_t *FileBuffer::getBufferStart() {
+ return reinterpret_cast<uint8_t *>(Buf->getBufferStart());
+ }
+
+-void MemBuffer::allocate(size_t Size) {
++Error MemBuffer::allocate(size_t Size) {
+ Buf = WritableMemoryBuffer::getNewMemBuffer(Size, getName());
++ return Error::success();
+ }
+
+ Error MemBuffer::commit() { return Error::success(); }
+diff --git a/llvm/tools/llvm-objcopy/Buffer.h b/llvm/tools/llvm-objcopy/Buffer.h
+index 482777fe05c..40670accac2 100644
+--- a/llvm/tools/llvm-objcopy/Buffer.h
++++ b/llvm/tools/llvm-objcopy/Buffer.h
+@@ -27,7 +27,7 @@ class Buffer {
+
+ public:
+ virtual ~Buffer();
+- virtual void allocate(size_t Size) = 0;
++ virtual Error allocate(size_t Size) = 0;
+ virtual uint8_t *getBufferStart() = 0;
+ virtual Error commit() = 0;
+
+@@ -39,7 +39,7 @@ class FileBuffer : public Buffer {
+ std::unique_ptr<FileOutputBuffer> Buf;
+
+ public:
+- void allocate(size_t Size) override;
++ Error allocate(size_t Size) override;
+ uint8_t *getBufferStart() override;
+ Error commit() override;
+
+@@ -50,7 +50,7 @@ class MemBuffer : public Buffer {
+ std::unique_ptr<WritableMemoryBuffer> Buf;
+
+ public:
+- void allocate(size_t Size) override;
++ Error allocate(size_t Size) override;
+ uint8_t *getBufferStart() override;
+ Error commit() override;
+
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+index 4f57131d5ab..db3589bb119 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+@@ -324,7 +324,8 @@ Error COFFWriter::write(bool IsBigObj) {
+ if (Error E = finalize(IsBigObj))
+ return E;
+
+- Buf.allocate(FileSize);
++ if (Error E = Buf.allocate(FileSize))
++ return E;
+
+ writeHeaders(IsBigObj);
+ writeSections();
+diff --git a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
+index a2996395c1f..2a52f1f9951 100644
+--- a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
+@@ -176,8 +176,10 @@ static void splitDWOToFile(const CopyConfig &Config, const Reader &Reader,
+ DWOFile->Machine = Config.OutputArch.getValue().EMachine;
+ FileBuffer FB(File);
+ auto Writer = createWriter(Config, *DWOFile, FB, OutputElfType);
+- Writer->finalize();
+- Writer->write();
++ if (Error E = Writer->finalize())
++ error(std::move(E));
++ if (Error E = Writer->write())
++ error(std::move(E));
+ }
+
+ static Error dumpSectionToFile(StringRef SecName, StringRef Filename,
+@@ -542,8 +544,10 @@ void executeObjcopyOnRawBinary(const CopyConfig &Config, MemoryBuffer &In,
+ handleArgs(Config, *Obj, Reader, OutputElfType);
+ std::unique_ptr<Writer> Writer =
+ createWriter(Config, *Obj, Out, OutputElfType);
+- Writer->finalize();
+- Writer->write();
++ if (Error E = Writer->finalize())
++ error(std::move(E));
++ if (Error E = Writer->write())
++ error(std::move(E));
+ }
+
+ void executeObjcopyOnBinary(const CopyConfig &Config,
+@@ -570,8 +574,10 @@ void executeObjcopyOnBinary(const CopyConfig &Config,
+ handleArgs(Config, *Obj, Reader, OutputElfType);
+ std::unique_ptr<Writer> Writer =
+ createWriter(Config, *Obj, Out, OutputElfType);
+- Writer->finalize();
+- Writer->write();
++ if (Error E = Writer->finalize())
++ error(std::move(E));
++ if (Error E = Writer->write())
++ error(std::move(E));
+ if (!Config.BuildIdLinkDir.empty() && Config.BuildIdLinkOutput) {
+ linkToBuildIdDir(Config, Config.OutputFilename,
+ Config.BuildIdLinkOutput.getValue(), BuildIdBytes);
+diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp
+index fecb752a39f..ef5dc5d7951 100644
+--- a/llvm/tools/llvm-objcopy/ELF/Object.cpp
++++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp
+@@ -1488,17 +1488,16 @@ template <class ELFT> size_t ELFWriter<ELFT>::totalSize() const {
+ NullSectionSize;
+ }
+
+-template <class ELFT> void ELFWriter<ELFT>::write() {
++template <class ELFT> Error ELFWriter<ELFT>::write() {
+ writeEhdr();
+ writePhdrs();
+ writeSectionData();
+ if (WriteSectionHeaders)
+ writeShdrs();
+- if (auto E = Buf.commit())
+- reportError(Buf.getName(), errorToErrorCode(std::move(E)));
++ return Buf.commit();
+ }
+
+-template <class ELFT> void ELFWriter<ELFT>::finalize() {
++template <class ELFT> Error ELFWriter<ELFT>::finalize() {
+ // It could happen that SectionNames has been removed and yet the user wants
+ // a section header table output. We need to throw an error if a user tries
+ // to do that.
+@@ -1582,21 +1581,22 @@ template <class ELFT> void ELFWriter<ELFT>::finalize() {
+ Section.finalize();
+ }
+
+- Buf.allocate(totalSize());
++ if (Error E = Buf.allocate(totalSize()))
++ return E;
+ SecWriter = llvm::make_unique<ELFSectionWriter<ELFT>>(Buf);
++ return Error::success();
+ }
+
+-void BinaryWriter::write() {
++Error BinaryWriter::write() {
+ for (auto &Section : Obj.sections()) {
+ if ((Section.Flags & SHF_ALLOC) == 0)
+ continue;
+ Section.accept(*SecWriter);
+ }
+- if (auto E = Buf.commit())
+- reportError(Buf.getName(), errorToErrorCode(std::move(E)));
++ return Buf.commit();
+ }
+
+-void BinaryWriter::finalize() {
++Error BinaryWriter::finalize() {
+ // TODO: Create a filter range to construct OrderedSegments from so that this
+ // code can be deduped with assignOffsets above. This should also solve the
+ // todo below for LayoutSections.
+@@ -1675,8 +1675,10 @@ void BinaryWriter::finalize() {
+ TotalSize = std::max(TotalSize, Section->Offset + Section->Size);
+ }
+
+- Buf.allocate(TotalSize);
++ if (Error E = Buf.allocate(TotalSize))
++ return E;
+ SecWriter = llvm::make_unique<BinarySectionWriter>(Buf);
++ return Error::success();
+ }
+
+ template class ELFBuilder<ELF64LE>;
+diff --git a/llvm/tools/llvm-objcopy/ELF/Object.h b/llvm/tools/llvm-objcopy/ELF/Object.h
+index 0dcb0d888bc..9e2b64be9dc 100644
+--- a/llvm/tools/llvm-objcopy/ELF/Object.h
++++ b/llvm/tools/llvm-objcopy/ELF/Object.h
+@@ -193,8 +193,8 @@ protected:
+
+ public:
+ virtual ~Writer();
+- virtual void finalize() = 0;
+- virtual void write() = 0;
++ virtual Error finalize() = 0;
++ virtual Error write() = 0;
+
+ Writer(Object &O, Buffer &B) : Obj(O), Buf(B) {}
+ };
+@@ -226,8 +226,8 @@ public:
+ virtual ~ELFWriter() {}
+ bool WriteSectionHeaders = true;
+
+- void finalize() override;
+- void write() override;
++ Error finalize() override;
++ Error write() override;
+ ELFWriter(Object &Obj, Buffer &Buf, bool WSH)
+ : Writer(Obj, Buf), WriteSectionHeaders(WSH) {}
+ };
+@@ -240,8 +240,8 @@ private:
+
+ public:
+ ~BinaryWriter() {}
+- void finalize() override;
+- void write() override;
++ Error finalize() override;
++ Error write() override;
+ BinaryWriter(Object &Obj, Buffer &Buf) : Writer(Obj, Buf) {}
+ };
+
+diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+index d27395f2ae0..75d513546b7 100644
+--- a/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
++++ b/llvm/tools/llvm-objcopy/llvm-objcopy.cpp
+@@ -56,6 +56,16 @@ LLVM_ATTRIBUTE_NORETURN void error(Twine Message) {
+ exit(1);
+ }
+
++LLVM_ATTRIBUTE_NORETURN void error(Error E) {
++ assert(E);
++ std::string Buf;
++ raw_string_ostream OS(Buf);
++ logAllUnhandledErrors(std::move(E), OS);
++ OS.flush();
++ WithColor::error(errs(), ToolName) << Buf;
++ exit(1);
++}
++
+ LLVM_ATTRIBUTE_NORETURN void reportError(StringRef File, std::error_code EC) {
+ assert(EC);
+ WithColor::error(errs(), ToolName)
+@@ -100,10 +110,11 @@ static Error deepWriteArchive(StringRef ArcName,
+ // NewArchiveMember still requires them even though writeArchive does not
+ // write them on disk.
+ FileBuffer FB(Member.MemberName);
+- FB.allocate(Member.Buf->getBufferSize());
++ if (Error E = FB.allocate(Member.Buf->getBufferSize()))
++ return E;
+ std::copy(Member.Buf->getBufferStart(), Member.Buf->getBufferEnd(),
+ FB.getBufferStart());
+- if (auto E = FB.commit())
++ if (Error E = FB.commit())
+ return E;
+ }
+ return Error::success();
+diff --git a/llvm/tools/llvm-objcopy/llvm-objcopy.h b/llvm/tools/llvm-objcopy/llvm-objcopy.h
+index 46d8339576c..18a789ca1f8 100644
+--- a/llvm/tools/llvm-objcopy/llvm-objcopy.h
++++ b/llvm/tools/llvm-objcopy/llvm-objcopy.h
+@@ -19,6 +19,7 @@ namespace llvm {
+ namespace objcopy {
+
+ LLVM_ATTRIBUTE_NORETURN extern void error(Twine Message);
++LLVM_ATTRIBUTE_NORETURN extern void error(Error E);
+ LLVM_ATTRIBUTE_NORETURN extern void reportError(StringRef File, Error E);
+ LLVM_ATTRIBUTE_NORETURN extern void reportError(StringRef File,
+ std::error_code EC);
+--
+2.17.1
+
diff --git a/projects/clang/win-patches/llvm-objcopy-9.patch b/projects/clang/win-patches/llvm-objcopy-9.patch
new file mode 100644
index 0000000..6cb4656
--- /dev/null
+++ b/projects/clang/win-patches/llvm-objcopy-9.patch
@@ -0,0 +1,260 @@
+From 840d70f854a1d550924ced1d00160efcc7b8549a Mon Sep 17 00:00:00 2001
+From: Martin Storsjo <martin(a)martin.st>
+Date: Wed, 23 Jan 2019 08:25:28 +0000
+Subject: [PATCH] Reapply: [llvm-objcopy] [COFF] Implement --add-gnu-debuglink
+
+This was reverted since it broke a couple buildbots. The reason
+for the breakage is not yet known, but this time, the test has
+got more diagnostics added, to hopefully allow figuring out
+what goes wrong.
+
+Differential Revision: https://reviews.llvm.org/D57007
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351931 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ .../llvm-objcopy/COFF/add-gnu-debuglink.test | 48 +++++++++++++++
+ tools/llvm-objcopy/COFF/COFFObjcopy.cpp | 61 +++++++++++++++++++
+ tools/llvm-objcopy/COFF/Object.cpp | 2 +-
+ tools/llvm-objcopy/COFF/Object.h | 26 +++++++-
+ tools/llvm-objcopy/COFF/Reader.cpp | 4 +-
+ tools/llvm-objcopy/COFF/Writer.cpp | 9 +--
+ 6 files changed, 143 insertions(+), 7 deletions(-)
+ create mode 100644 test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test
+
+diff --git a/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test b/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test
+new file mode 100644
+index 00000000000..cf3a9bba920
+--- /dev/null
++++ b/llvm/test/tools/llvm-objcopy/COFF/add-gnu-debuglink.test
+@@ -0,0 +1,48 @@
++RUN: yaml2obj %p/Inputs/x86_64-exe.yaml > %t.in123.exe
++
++# Using a debuglink filename with a length that is a multiple of 4, to
++# showcase padding in CONTENTS below.
++
++RUN: llvm-objcopy --add-gnu-debuglink=%t.in123.exe %t.in123.exe %t.out.exe
++
++# Temporary debugging of issues with this test:
++RUN: ls -l %t.out.exe || true
++RUN: od -Ax -t x1 %t.out.exe || true
++RUN: llvm-readobj -sections %t.out.exe || true
++
++RUN: llvm-readobj -sections %t.out.exe | FileCheck %s --check-prefix=SECTIONS
++RUN: llvm-objdump -s %t.out.exe | FileCheck %s --check-prefix=CONTENTS
++
++# Show the last of the preexisting sections, which is used for choosing
++# a virtual address for the generated one.
++
++SECTIONS: Section {
++SECTIONS: Number: 4
++SECTIONS-NEXT: Name: .pdata
++SECTIONS-NEXT: VirtualSize: 0x18
++SECTIONS-NEXT: VirtualAddress: 0x4000
++SECTIONS-NEXT: RawDataSize: 512
++SECTIONS: Section {
++SECTIONS-NEXT: Number: 5
++SECTIONS-NEXT: Name: .gnu_debuglink
++SECTIONS-NEXT: VirtualSize: 0x2C
++SECTIONS-NEXT: VirtualAddress: 0x5000
++SECTIONS-NEXT: RawDataSize: 512
++SECTIONS-NEXT: PointerToRawData:
++SECTIONS-NEXT: PointerToRelocations:
++SECTIONS-NEXT: PointerToLineNumbers:
++SECTIONS-NEXT: RelocationCount:
++SECTIONS-NEXT: LineNumberCount:
++SECTIONS-NEXT: Characteristics [ (0x42000040)
++SECTIONS-NEXT: IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
++SECTIONS-NEXT: IMAGE_SCN_MEM_DISCARDABLE (0x2000000)
++SECTIONS-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
++SECTIONS-NEXT: ]
++
++# Note: The last 4 bytes here are the crc of the referenced file - if the
++# yaml2obj generated file changes, this crc changes.
++
++CONTENTS: Contents of section .gnu_debuglink:
++CONTENTS: 40005000 6164642d 676e752d 64656275 676c696e add-gnu-debuglin
++CONTENTS: 40005010 6b2e7465 73742e74 6d702e69 6e313233 k.test.tmp.in123
++CONTENTS: 40005020 2e657865 00000000 7929adc3 .exe
+diff --git a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+index 8d8f53d13d8..20adbe11e7a 100644
+--- a/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
+@@ -17,6 +17,8 @@
+ #include "llvm/Object/Binary.h"
+ #include "llvm/Object/COFF.h"
+ #include "llvm/Support/Errc.h"
++#include "llvm/Support/JamCRC.h"
++#include "llvm/Support/Path.h"
+ #include <cassert>
+
+ namespace llvm {
+@@ -30,6 +32,61 @@ static bool isDebugSection(const Section &Sec) {
+ return Sec.Name.startswith(".debug");
+ }
+
++static uint64_t getNextRVA(const Object &Obj) {
++ if (Obj.getSections().empty())
++ return 0;
++ const Section &Last = Obj.getSections().back();
++ return alignTo(Last.Header.VirtualAddress + Last.Header.VirtualSize,
++ Obj.PeHeader.SectionAlignment);
++}
++
++static uint32_t getCRC32(StringRef Data) {
++ JamCRC CRC;
++ CRC.update(ArrayRef<char>(Data.data(), Data.size()));
++ // The CRC32 value needs to be complemented because the JamCRC dosn't
++ // finalize the CRC32 value. It also dosn't negate the initial CRC32 value
++ // but it starts by default at 0xFFFFFFFF which is the complement of zero.
++ return ~CRC.getCRC();
++}
++
++static std::vector<uint8_t> createGnuDebugLinkSectionContents(StringRef File) {
++ ErrorOr<std::unique_ptr<MemoryBuffer>> LinkTargetOrErr =
++ MemoryBuffer::getFile(File);
++ if (!LinkTargetOrErr)
++ error("'" + File + "': " + LinkTargetOrErr.getError().message());
++ auto LinkTarget = std::move(*LinkTargetOrErr);
++ uint32_t CRC32 = getCRC32(LinkTarget->getBuffer());
++
++ StringRef FileName = sys::path::filename(File);
++ size_t CRCPos = alignTo(FileName.size() + 1, 4);
++ std::vector<uint8_t> Data(CRCPos + 4);
++ memcpy(Data.data(), FileName.data(), FileName.size());
++ support::endian::write32le(Data.data() + CRCPos, CRC32);
++ return Data;
++}
++
++static void addGnuDebugLink(Object &Obj, StringRef DebugLinkFile) {
++ uint32_t StartRVA = getNextRVA(Obj);
++
++ std::vector<Section> Sections;
++ Section Sec;
++ Sec.setOwnedContents(createGnuDebugLinkSectionContents(DebugLinkFile));
++ Sec.Name = ".gnu_debuglink";
++ Sec.Header.VirtualSize = Sec.getContents().size();
++ Sec.Header.VirtualAddress = StartRVA;
++ Sec.Header.SizeOfRawData =
++ alignTo(Sec.Header.VirtualSize, Obj.PeHeader.FileAlignment);
++ // Sec.Header.PointerToRawData is filled in by the writer.
++ Sec.Header.PointerToRelocations = 0;
++ Sec.Header.PointerToLinenumbers = 0;
++ // Sec.Header.NumberOfRelocations is filled in by the writer.
++ Sec.Header.NumberOfLinenumbers = 0;
++ Sec.Header.Characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA |
++ IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_DISCARDABLE;
++ Sections.push_back(Sec);
++ Obj.addSections(Sections);
++}
++
+ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
+ // Perform the actual section removals.
+ Obj.removeSections([&Config](const Section &Sec) {
+@@ -109,6 +166,10 @@ static Error handleArgs(const CopyConfig &Config, Object &Obj) {
+
+ return false;
+ });
++
++ if (!Config.AddGnuDebugLink.empty())
++ addGnuDebugLink(Obj, Config.AddGnuDebugLink);
++
+ return Error::success();
+ }
+
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.cpp b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+index 83435dffa98..8c382c1faef 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Object.cpp
+@@ -129,7 +129,7 @@ void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
+ void Object::truncateSections(function_ref<bool(const Section &)> ToTruncate) {
+ for (Section &Sec : Sections) {
+ if (ToTruncate(Sec)) {
+- Sec.Contents = ArrayRef<uint8_t>();
++ Sec.clearContents();
+ Sec.Relocs.clear();
+ Sec.Header.SizeOfRawData = 0;
+ }
+diff --git a/llvm/tools/llvm-objcopy/COFF/Object.h b/llvm/tools/llvm-objcopy/COFF/Object.h
+index 0630f9c5ff8..afa272286ef 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Object.h
++++ b/llvm/tools/llvm-objcopy/COFF/Object.h
+@@ -35,11 +35,35 @@ struct Relocation {
+
+ struct Section {
+ object::coff_section Header;
+- ArrayRef<uint8_t> Contents;
+ std::vector<Relocation> Relocs;
+ StringRef Name;
+ ssize_t UniqueId;
+ size_t Index;
++
++ ArrayRef<uint8_t> getContents() const {
++ if (!OwnedContents.empty())
++ return OwnedContents;
++ return ContentsRef;
++ }
++
++ void setContentsRef(ArrayRef<uint8_t> Data) {
++ OwnedContents.clear();
++ ContentsRef = Data;
++ }
++
++ void setOwnedContents(std::vector<uint8_t> &&Data) {
++ ContentsRef = ArrayRef<uint8_t>();
++ OwnedContents = std::move(Data);
++ }
++
++ void clearContents() {
++ ContentsRef = ArrayRef<uint8_t>();
++ OwnedContents.clear();
++ }
++
++private:
++ ArrayRef<uint8_t> ContentsRef;
++ std::vector<uint8_t> OwnedContents;
+ };
+
+ struct Symbol {
+diff --git a/llvm/tools/llvm-objcopy/COFF/Reader.cpp b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+index 2446277cc2b..87dd60a43cf 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Reader.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Reader.cpp
+@@ -69,8 +69,10 @@ Error COFFReader::readSections(Object &Obj) const {
+ Sections.push_back(Section());
+ Section &S = Sections.back();
+ S.Header = *Sec;
+- if (auto EC = COFFObj.getSectionContents(Sec, S.Contents))
++ ArrayRef<uint8_t> Contents;
++ if (auto EC = COFFObj.getSectionContents(Sec, Contents))
+ return errorCodeToError(EC);
++ S.setContentsRef(Contents);
+ ArrayRef<coff_relocation> Relocs = COFFObj.getRelocations(Sec);
+ for (const coff_relocation &R : Relocs)
+ S.Relocs.push_back(R);
+diff --git a/llvm/tools/llvm-objcopy/COFF/Writer.cpp b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+index db3589bb119..05e46291c39 100644
+--- a/llvm/tools/llvm-objcopy/COFF/Writer.cpp
++++ b/llvm/tools/llvm-objcopy/COFF/Writer.cpp
+@@ -286,14 +286,15 @@ void COFFWriter::writeHeaders(bool IsBigObj) {
+ void COFFWriter::writeSections() {
+ for (const auto &S : Obj.getSections()) {
+ uint8_t *Ptr = Buf.getBufferStart() + S.Header.PointerToRawData;
+- std::copy(S.Contents.begin(), S.Contents.end(), Ptr);
++ ArrayRef<uint8_t> Contents = S.getContents();
++ std::copy(Contents.begin(), Contents.end(), Ptr);
+
+ // For executable sections, pad the remainder of the raw data size with
+ // 0xcc, which is int3 on x86.
+ if ((S.Header.Characteristics & IMAGE_SCN_CNT_CODE) &&
+- S.Header.SizeOfRawData > S.Contents.size())
+- memset(Ptr + S.Contents.size(), 0xcc,
+- S.Header.SizeOfRawData - S.Contents.size());
++ S.Header.SizeOfRawData > Contents.size())
++ memset(Ptr + Contents.size(), 0xcc,
++ S.Header.SizeOfRawData - Contents.size());
+
+ Ptr += S.Header.SizeOfRawData;
+ for (const auto &R : S.Relocs) {
+--
+2.17.1
+
1
0
[tor-browser-build/master] Merge remote-tracking branch 'boklm/bug_30585_v2'
by gk@torproject.org 31 Jul '19
by gk@torproject.org 31 Jul '19
31 Jul '19
commit 7b6444dd34d7a9e32d619c194e078464529fd5c1
Merge: 525e93a 4c2b3a9
Author: Georg Koppen <gk(a)torproject.org>
Date: Wed Jul 31 09:27:04 2019 +0000
Merge remote-tracking branch 'boklm/bug_30585_v2'
keyring/clang.gpg | Bin 0 -> 7186 bytes
projects/clang/build | 45 ++
projects/clang/config | 45 ++
projects/clang/win-patches/llvm-objcopy-1.patch | 27 +
projects/clang/win-patches/llvm-objcopy-10.patch | 28 +
projects/clang/win-patches/llvm-objcopy-11.patch | 377 +++++++++++++
projects/clang/win-patches/llvm-objcopy-12.patch | 43 ++
projects/clang/win-patches/llvm-objcopy-2.patch | 665 +++++++++++++++++++++++
projects/clang/win-patches/llvm-objcopy-3.patch | 160 ++++++
projects/clang/win-patches/llvm-objcopy-4.patch | 222 ++++++++
projects/clang/win-patches/llvm-objcopy-5.patch | 61 +++
projects/clang/win-patches/llvm-objcopy-6.patch | 242 +++++++++
projects/clang/win-patches/llvm-objcopy-7.patch | 224 ++++++++
projects/clang/win-patches/llvm-objcopy-8.patch | 330 +++++++++++
projects/clang/win-patches/llvm-objcopy-9.patch | 260 +++++++++
15 files changed, 2729 insertions(+)
1
0
commit 525e93a130757ab4df445888ecc211bace1122eb
Author: Georg Koppen <gk(a)torproject.org>
Date: Tue Jul 30 20:38:50 2019 +0000
Release prep for 9.0a5
We want to better test aarch64 support on Google Play before the 64bit
requirement on Aug 1 is getting enforced.
---
projects/firefox/config | 2 +-
projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt | 4 ++++
rbm.conf | 4 ++--
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/projects/firefox/config b/projects/firefox/config
index 9565b8e..0b340f5 100644
--- a/projects/firefox/config
+++ b/projects/firefox/config
@@ -1,7 +1,7 @@
# vim: filetype=yaml sw=2
version: '[% c("abbrev") %]'
filename: 'firefox-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %]'
-git_hash: 'tor-browser-[% c("var/firefox_version") %]-[% c("var/torbrowser_branch") %]-1-build1'
+git_hash: 'tor-browser-[% c("var/firefox_version") %]-[% c("var/torbrowser_branch") %]-1-build2'
tag_gpg_id: 1
git_url: https://git.torproject.org/tor-browser.git
git_submodule: 1
diff --git a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
index ffab828..594225a 100644
--- a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
+++ b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
@@ -1,3 +1,7 @@
+Tor Browser 9.0a5 -- July 31 2019
+ * Android
+ * Bug 31260: Backport bug 1477259 for aarch64 support on Google Play
+
Tor Browser 9.0a4 -- July 9 2019
* All platforms
* Update Firefox to 60.8.0esr
diff --git a/rbm.conf b/rbm.conf
index 4f6e943..76695f3 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -24,8 +24,8 @@ buildconf:
git_signtag_opt: '-s'
var:
- torbrowser_version: '9.0a4'
- torbrowser_build: 'build2'
+ torbrowser_version: '9.0a5'
+ torbrowser_build: 'build1'
torbrowser_incremental_from:
- 9.0a3
project_name: tor-browser
1
0
[tor-browser/tor-browser-60.8.0esr-8.5-1] Bug 1477259 - Use separate version codes for 64-bit builds; r=nalexander
by gk@torproject.org 30 Jul '19
by gk@torproject.org 30 Jul '19
30 Jul '19
commit 3111f2ee9a389db8d4c4f025b34314f8fe42d865
Author: Jim Chen <nchen(a)mozilla.com>
Date: Thu Aug 30 21:51:18 2018 +0000
Bug 1477259 - Use separate version codes for 64-bit builds; r=nalexander
Use the unused 'p' bit in the version code to denote 64-bit builds, so
we have different version codes for 64-bit builds on aarch64 and x86-64.
Differential Revision: https://phabricator.services.mozilla.com/D4260
--HG--
extra : moz-landing-system : lando
---
python/mozbuild/mozbuild/android_version_code.py | 53 ++++++++++++------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/python/mozbuild/mozbuild/android_version_code.py b/python/mozbuild/mozbuild/android_version_code.py
index 5e786b2358c0..92392d563c42 100644
--- a/python/mozbuild/mozbuild/android_version_code.py
+++ b/python/mozbuild/mozbuild/android_version_code.py
@@ -49,26 +49,24 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
The bits labelled 'x', 'p', and 'g' are feature flags.
- The bit labelled 'x' is 1 if the build is for an x86 or ARM64 architecture,
- and 0 otherwise, which means the build is for a (32-bit) ARM architecture.
+ The bit labelled 'x' is 1 if the build is for an x86 or x86-64 architecture,
+ and 0 otherwise, which means the build is for an ARM or ARM64 architecture.
(Fennec no longer supports ARMv6, so ARM is equivalent to ARMv7.
ARM64 is also known as AArch64; it is logically ARMv8.)
- For the same release, x86 and ARM64 builds have higher version codes and
+ For the same release, x86 and x86_64 builds have higher version codes and
take precedence over ARM builds, so that they are preferred over ARM on
devices that have ARM emulation.
- The bit labelled 'p' is a placeholder that is always 0 (for now).
+ The bit labelled 'p' is 1 if the build is for a 64-bit architecture (x86-64
+ or ARM64), and 0 otherwise, which means the build is for a 32-bit
+ architecture (x86 or ARM). 64-bit builds have higher version codes so
+ they take precedence over 32-bit builds on devices that support 64-bit.
- Firefox no longer supports API 14 or earlier.
-
- This version code computation allows for a split on API levels that allowed
- us to ship builds specifically for Gingerbread (API 9-10); we preserve
- that functionality for sanity's sake, and to allow us to reintroduce a
- split in the future.
-
- At present, the bit labelled 'g' is 1 if the build is an ARM build
- targeting API 16+, which will always be the case.
+ The bit labelled 'g' is 1 if the build targets a recent API level, which
+ is currently always the case, because Firefox no longer ships releases that
+ are split by API levels. However, we may reintroduce a split in the future,
+ in which case the release that targets an older API level will
We throw an explanatory exception when we are within one calendar year of
running out of build events. This gives lots of time to update the version
@@ -113,24 +111,27 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
# for architecture and APK splits.
version |= base << 3
- # None is interpreted as arm.
- if not cpu_arch or cpu_arch == 'armeabi-v7a':
- # 0 is interpreted as SDK 9.
- if not min_sdk or min_sdk == 9:
- pass
- # This used to compare to 11. The 16+ APK directly supersedes 11+, so
- # we reuse this check.
- elif min_sdk == 16:
- version |= 1 << 0
- else:
- raise ValueError("Don't know how to compute android:versionCode "
- "for CPU arch %s and min SDK %s" % (cpu_arch, min_sdk))
- elif cpu_arch in ['x86', 'arm64-v8a']:
+ # 'x' bit is 1 for x86/x86-64 architectures (`None` is interpreted as ARM).
+ if cpu_arch in ['x86', 'x86_64']:
version |= 1 << 2
+ elif not cpu_arch or cpu_arch in ['armeabi-v7a', 'arm64-v8a']:
+ pass
else:
raise ValueError("Don't know how to compute android:versionCode "
"for CPU arch %s" % cpu_arch)
+ # 'p' bit is 1 for 64-bit architectures.
+ if cpu_arch in ['arm64-v8a', 'x86_64']:
+ version |= 1 << 1
+ elif cpu_arch in ['armeabi-v7a', 'x86']:
+ pass
+ else:
+ raise ValueError("Don't know how to compute android:versionCode "
+ "for CPU arch %s" % cpu_arch)
+
+ # 'g' bit is currently always 1, but may depend on `min_sdk` in the future.
+ version |= 1 << 0
+
return version
def android_version_code(buildid, *args, **kwargs):
1
0
[tor-browser/tor-browser-60.8.0esr-9.0-1] Bug 1477259 - Use separate version codes for 64-bit builds; r=nalexander
by gk@torproject.org 30 Jul '19
by gk@torproject.org 30 Jul '19
30 Jul '19
commit c847e888cd2a4fb7cbddfe8fc890fe25a024faf7
Author: Jim Chen <nchen(a)mozilla.com>
Date: Thu Aug 30 21:51:18 2018 +0000
Bug 1477259 - Use separate version codes for 64-bit builds; r=nalexander
Use the unused 'p' bit in the version code to denote 64-bit builds, so
we have different version codes for 64-bit builds on aarch64 and x86-64.
Differential Revision: https://phabricator.services.mozilla.com/D4260
--HG--
extra : moz-landing-system : lando
---
python/mozbuild/mozbuild/android_version_code.py | 53 ++++++++++++------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/python/mozbuild/mozbuild/android_version_code.py b/python/mozbuild/mozbuild/android_version_code.py
index 5e786b2358c0..92392d563c42 100644
--- a/python/mozbuild/mozbuild/android_version_code.py
+++ b/python/mozbuild/mozbuild/android_version_code.py
@@ -49,26 +49,24 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
The bits labelled 'x', 'p', and 'g' are feature flags.
- The bit labelled 'x' is 1 if the build is for an x86 or ARM64 architecture,
- and 0 otherwise, which means the build is for a (32-bit) ARM architecture.
+ The bit labelled 'x' is 1 if the build is for an x86 or x86-64 architecture,
+ and 0 otherwise, which means the build is for an ARM or ARM64 architecture.
(Fennec no longer supports ARMv6, so ARM is equivalent to ARMv7.
ARM64 is also known as AArch64; it is logically ARMv8.)
- For the same release, x86 and ARM64 builds have higher version codes and
+ For the same release, x86 and x86_64 builds have higher version codes and
take precedence over ARM builds, so that they are preferred over ARM on
devices that have ARM emulation.
- The bit labelled 'p' is a placeholder that is always 0 (for now).
+ The bit labelled 'p' is 1 if the build is for a 64-bit architecture (x86-64
+ or ARM64), and 0 otherwise, which means the build is for a 32-bit
+ architecture (x86 or ARM). 64-bit builds have higher version codes so
+ they take precedence over 32-bit builds on devices that support 64-bit.
- Firefox no longer supports API 14 or earlier.
-
- This version code computation allows for a split on API levels that allowed
- us to ship builds specifically for Gingerbread (API 9-10); we preserve
- that functionality for sanity's sake, and to allow us to reintroduce a
- split in the future.
-
- At present, the bit labelled 'g' is 1 if the build is an ARM build
- targeting API 16+, which will always be the case.
+ The bit labelled 'g' is 1 if the build targets a recent API level, which
+ is currently always the case, because Firefox no longer ships releases that
+ are split by API levels. However, we may reintroduce a split in the future,
+ in which case the release that targets an older API level will
We throw an explanatory exception when we are within one calendar year of
running out of build events. This gives lots of time to update the version
@@ -113,24 +111,27 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
# for architecture and APK splits.
version |= base << 3
- # None is interpreted as arm.
- if not cpu_arch or cpu_arch == 'armeabi-v7a':
- # 0 is interpreted as SDK 9.
- if not min_sdk or min_sdk == 9:
- pass
- # This used to compare to 11. The 16+ APK directly supersedes 11+, so
- # we reuse this check.
- elif min_sdk == 16:
- version |= 1 << 0
- else:
- raise ValueError("Don't know how to compute android:versionCode "
- "for CPU arch %s and min SDK %s" % (cpu_arch, min_sdk))
- elif cpu_arch in ['x86', 'arm64-v8a']:
+ # 'x' bit is 1 for x86/x86-64 architectures (`None` is interpreted as ARM).
+ if cpu_arch in ['x86', 'x86_64']:
version |= 1 << 2
+ elif not cpu_arch or cpu_arch in ['armeabi-v7a', 'arm64-v8a']:
+ pass
else:
raise ValueError("Don't know how to compute android:versionCode "
"for CPU arch %s" % cpu_arch)
+ # 'p' bit is 1 for 64-bit architectures.
+ if cpu_arch in ['arm64-v8a', 'x86_64']:
+ version |= 1 << 1
+ elif cpu_arch in ['armeabi-v7a', 'x86']:
+ pass
+ else:
+ raise ValueError("Don't know how to compute android:versionCode "
+ "for CPU arch %s" % cpu_arch)
+
+ # 'g' bit is currently always 1, but may depend on `min_sdk` in the future.
+ version |= 1 << 0
+
return version
def android_version_code(buildid, *args, **kwargs):
1
0
commit d249b24614605f02d76f7ceff02aba27f2ebdf6f
Author: Georg Koppen <gk(a)torproject.org>
Date: Fri Jul 19 10:00:45 2019 +0000
Fold in stable changelog
---
projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
index 63c6606..ffab828 100644
--- a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
+++ b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
@@ -24,6 +24,24 @@ Tor Browser 9.0a4 -- July 9 2019
* Android
* Bug 28119: Tor Browser for aarch64
+Tor Browser 8.5.4 -- July 9 2019
+ * All platforms
+ * Update Firefox to 60.8.0esr
+ * Update Torbutton to 2.1.12
+ * Bug 30577: Add Fundraising Banner
+ * Bug 31041: Stop syncing network.cookie.lifetimePolicy
+ * Translations update
+ * Update HTTPS Everywhere to 2019.6.27
+ * Bug 31055+31058: Remove four default bridges
+ * Bug 30712: Backport fix for Mozilla's bug 1552993
+ * Bug 30849: Backport fixes for Mozilla's bug 1552627 and 1549833
+ * Windows + OS X + Linux
+ * Update Tor to 0.4.0.5
+ * Update OpenSSL to 1.0.2s
+ * Bug 29045: Ensure that tor does not start up in dormant mode
+ * OS X
+ * Bug 30631: Blurry Tor Browser icon on macOS app switcher
+
Tor Browser 9.0a3 -- June 24 2019
* All platforms
* Pick up fixes for Mozilla's bug 1544386 and 1560192
1
0
commit 958c5fef2072692464417012c1cb551f1858bab4
Author: Georg Koppen <gk(a)torproject.org>
Date: Tue Jul 9 17:56:34 2019 +0000
Correct Changelog
It seems #30573 did not get solved in that alpha. Remove the entry.
---
projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
index 5a1a67a..63c6606 100644
--- a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
+++ b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
@@ -23,7 +23,6 @@ Tor Browser 9.0a4 -- July 9 2019
* Bug 30631: Blurry Tor Browser icon on macOS app switcher
* Android
* Bug 28119: Tor Browser for aarch64
- * Bug 30573: Sanitize old tabs and wait for tor before opening new tabs
Tor Browser 9.0a3 -- June 24 2019
* All platforms
1
0
08 Jul '19
commit 248aaaa5e02b5aff0b438e563b6a73692b4533f9
Author: Nicolas Vigier <boklm(a)torproject.org>
Date: Mon Jul 8 23:27:15 2019 +0200
Remove obfs3 tests
With #31055 we don't have default obfs3 bridges anymore.
---
TBBTestSuite/TestSuite/BrowserBundleTests.pm | 15 ---------------
tor-config/tor_obfs3.conf | 15 ---------------
tor-config/tor_obfs3_httpproxy.conf | 2 --
3 files changed, 32 deletions(-)
diff --git a/TBBTestSuite/TestSuite/BrowserBundleTests.pm b/TBBTestSuite/TestSuite/BrowserBundleTests.pm
index a7ad663..cf580f0 100644
--- a/TBBTestSuite/TestSuite/BrowserBundleTests.pm
+++ b/TBBTestSuite/TestSuite/BrowserBundleTests.pm
@@ -219,21 +219,6 @@ our @tests = (
run_once => 1,
},
{
- name => 'tor_obfs3',
- type => 'tor_bootstrap',
- descr => 'Access tor using obfs3',
- enable => sub { $OSNAME eq 'linux' && $options->{PTtests} },
- run_once => 1,
- },
- {
- name => 'tor_obfs3_httpproxy',
- type => 'tor_bootstrap',
- descr => 'Access tor using obfs3 and an http proxy',
- httpproxy => 1,
- enable => sub { $OSNAME eq 'linux' && $options->{PTtests} },
- run_once => 1,
- },
- {
name => 'tor_obfs4',
type => 'tor_bootstrap',
descr => 'Access tor using obfs4',
diff --git a/tor-config/tor_obfs3.conf b/tor-config/tor_obfs3.conf
deleted file mode 100644
index 42b9b14..0000000
--- a/tor-config/tor_obfs3.conf
+++ /dev/null
@@ -1,15 +0,0 @@
-[% INCLUDE main_config %]
-[% IF tbbinfos.os == 'Windows';
- SET bin_ext = 'exe';
- ELSE;
- SET bin_ext = 'bin';
- END;
--%]
-
-UseBridges 1
-Bridge obfs3 83.212.101.3:80 A09D536DD1752D542E1FBB3C9CE4449D51298239
-Bridge obfs3 169.229.59.74:31493 AF9F66B7B04F8FF6F32D455F05135250A16543C9
-Bridge obfs3 169.229.59.75:46328 AF9F66B7B04F8FF6F32D455F05135250A16543C9
-Bridge obfs3 109.105.109.163:38980 1E05F577A0EC0213F971D81BF4D86A9E4E8229ED
-Bridge obfs3 109.105.109.163:47779 4C331FA9B3D1D6D8FB0D8FBBF0C259C360D97E6A
-ClientTransportPlugin obfs3 exec [% tbbinfos.ptdir %]/obfsproxy.[% bin_ext %] managed
diff --git a/tor-config/tor_obfs3_httpproxy.conf b/tor-config/tor_obfs3_httpproxy.conf
deleted file mode 100644
index 1e4753b..0000000
--- a/tor-config/tor_obfs3_httpproxy.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[% INCLUDE tor_obfs3.conf %]
-[% INCLUDE http_proxy %]
1
0
[tor-browser-build/master] Bug 31054: Add android-aarch64 nightly builds
by boklm@torproject.org 08 Jul '19
by boklm@torproject.org 08 Jul '19
08 Jul '19
commit 7bee08d921c147712a69140c44b506eaf19d57d6
Author: Nicolas Vigier <boklm(a)torproject.org>
Date: Mon Jul 8 19:20:05 2019 +0200
Bug 31054: Add android-aarch64 nightly builds
Update the tor-browser-bundle-testsuite.git commit, to add
android-aarch64 nightly builds.
At the same time, we update the tor-browser-bundle-testsuite.git URL to
use the repository that created with #30516.
---
tools/ansible/roles/tbb-nightly-build/defaults/main.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/ansible/roles/tbb-nightly-build/defaults/main.yml b/tools/ansible/roles/tbb-nightly-build/defaults/main.yml
index 2a4cc6e..acc88f9 100644
--- a/tools/ansible/roles/tbb-nightly-build/defaults/main.yml
+++ b/tools/ansible/roles/tbb-nightly-build/defaults/main.yml
@@ -4,8 +4,8 @@ nightly_build_cron_hour: 2
nightly_build_cron_minute: 20
nightly_build_keep_builds: 2
testsuite_dir: "/home/{{ nightly_build_user }}/tbb-testsuite"
-testsuite_git_url: https://git.torproject.org/user/boklm/tor-browser-bundle-testsuite.git
-testsuite_git_commit: 9283635ace22c3a7f629b5bc60e8fec0af4dc13c
+testsuite_git_url: https://git.torproject.org/tor-browser-bundle-testsuite.git
+testsuite_git_commit: 6a2c39273bfd729446ef787e4f7d1bf3138cfc4a
nightly_build_wwwdir: "/home/{{ nightly_build_user }}/www"
nightly_build_nginx_enable: true
nightly_build_nginx_listen: 127.0.0.1:80
1
0
[tor-browser-bundle-testsuite/master] .gitkeyring: Add new sub-keys
by boklm@torproject.org 08 Jul '19
by boklm@torproject.org 08 Jul '19
08 Jul '19
commit 6a2c39273bfd729446ef787e4f7d1bf3138cfc4a
Author: Nicolas Vigier <boklm(a)torproject.org>
Date: Mon Jul 8 19:13:18 2019 +0200
.gitkeyring: Add new sub-keys
Update .gitkeyring to add a new sub-key, fixing pulling of this git
repository using the tools/pull script.
---
.gitkeyring | Bin 11674 -> 5610 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/.gitkeyring b/.gitkeyring
index b1622f1..cceaf37 100644
Binary files a/.gitkeyring and b/.gitkeyring differ
1
0
[tor-browser-bundle-testsuite/master] Bug 31054: Add android-aarch64 to nightly builds
by boklm@torproject.org 08 Jul '19
by boklm@torproject.org 08 Jul '19
08 Jul '19
commit c705352fa1e043b5659548633dccaa468903e0f9
Author: Nicolas Vigier <boklm(a)torproject.org>
Date: Mon Jul 8 18:44:25 2019 +0200
Bug 31054: Add android-aarch64 to nightly builds
---
TBBTestSuite/TestSuite/TorBrowserBuild.pm | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/TBBTestSuite/TestSuite/TorBrowserBuild.pm b/TBBTestSuite/TestSuite/TorBrowserBuild.pm
index f1f88e1..a6def45 100644
--- a/TBBTestSuite/TestSuite/TorBrowserBuild.pm
+++ b/TBBTestSuite/TestSuite/TorBrowserBuild.pm
@@ -103,6 +103,18 @@ sub set_tests {
],
publish_dir => 'nightly-android-x86',
},
+ {
+ name => 'nightly-android-aarch64',
+ descr => 'build tor-browser nightly android-aarch64',
+ type => 'rbm_build',
+ project => 'release',
+ targets => [
+ 'noversiondir',
+ 'nightly',
+ 'torbrowser-android-aarch64',
+ ],
+ publish_dir => 'nightly-android-aarch64',
+ },
];
}
1
0
[tor-browser-build/master] FIXUP: recreated 27503.patch against widl sources without dev debug logging
by gk@torproject.org 08 Jul '19
by gk@torproject.org 08 Jul '19
08 Jul '19
commit 054c4d0f2502698f0803db7574bc0e229a66dfec
Author: Richard Pospesel <richard(a)torproject.org>
Date: Fri Jul 5 13:45:51 2019 -0700
FIXUP: recreated 27503.patch against widl sources without dev debug logging
---
projects/mingw-w64/27503.patch | 258 ++++++++++++++---------------------------
1 file changed, 90 insertions(+), 168 deletions(-)
diff --git a/projects/mingw-w64/27503.patch b/projects/mingw-w64/27503.patch
index f6bd197..ca542d0 100644
--- a/projects/mingw-w64/27503.patch
+++ b/projects/mingw-w64/27503.patch
@@ -1161,7 +1161,7 @@ index 0d44b403..0e62f77c 100644
return 1;
return 0;
diff --git a/mingw-w64-tools/widl/src/parser.tab.c b/mingw-w64-tools/widl/src/parser.tab.c
-index 6266e054..d7053e79 100644
+index 6266e054..8cd1605a 100644
--- a/mingw-w64-tools/widl/src/parser.tab.c
+++ b/mingw-w64-tools/widl/src/parser.tab.c
@@ -1,8 +1,8 @@
@@ -4829,7 +4829,7 @@ index 6266e054..d7053e79 100644
int top)
{
var_t *v = decl->var;
-@@ -5638,58 +5685,80 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -5638,58 +5685,74 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
expr_t *dim;
type_t **ptype;
type_t *func_type = decl ? decl->func_type : NULL;
@@ -4912,12 +4912,6 @@ index 6266e054..d7053e79 100644
- if (!ptr_attr && top && (*pt)->details.pointer.def_fc != FC_RP)
+ if (!ptr_attr && top && type_pointer_get_default_fc(*pt) != FC_RP)
{
-+ printf("dup_pointer_type!\n");
-+ printf("type : %p name : %s\n", *pt, (*pt)->name);
-+ /* ptr_attr is ref,unique or full (FC_RP, FC_UP, FC_FP) */
-+ /* *pt could be the var's declspec's type OR a type on a typedef */
-+ /* not an array */
-+
/* FIXME: this is a horrible hack to cope with the issue that we
* store an offset to the typeformat string in the type object, but
* two typeformat strings may be written depending on whether the
@@ -4927,7 +4921,7 @@ index 6266e054..d7053e79 100644
}
}
else if (ptr_attr)
-@@ -5700,16 +5769,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -5700,16 +5763,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
{
type_t *t = type;
@@ -4947,7 +4941,7 @@ index 6266e054..d7053e79 100644
else
break;
}
-@@ -5726,15 +5795,15 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -5726,15 +5789,15 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
if (is_attr(v->attrs, ATTR_V1ENUM))
{
@@ -4966,7 +4960,7 @@ index 6266e054..d7053e79 100644
if (sizes) LIST_FOR_EACH_ENTRY(dim, sizes, expr_t, entry)
{
if (dim->type != EXPR_VOID)
-@@ -5747,7 +5816,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -5747,7 +5810,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
else
*ptype = type_new_array((*ptype)->name,
type_array_get_element(*ptype), FALSE,
@@ -4975,7 +4969,7 @@ index 6266e054..d7053e79 100644
}
else if (is_ptr(*ptype))
*ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), TRUE,
-@@ -5756,15 +5825,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -5756,15 +5819,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
error_loc("%s: size_is attribute applied to illegal type\n", v->name);
}
@@ -4995,7 +4989,7 @@ index 6266e054..d7053e79 100644
if (lengs) LIST_FOR_EACH_ENTRY(dim, lengs, expr_t, entry)
{
if (dim->type != EXPR_VOID)
-@@ -5782,10 +5852,11 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -5782,10 +5846,11 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
error_loc("%s: length_is attribute applied to illegal type\n", v->name);
}
@@ -5009,7 +5003,7 @@ index 6266e054..d7053e79 100644
else
error_loc("%s: too many expressions in length_is attribute\n", v->name);
}
-@@ -5796,29 +5867,31 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -5796,29 +5861,31 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
if (func_type)
{
type_t *ft, *t;
@@ -5050,7 +5044,7 @@ index 6266e054..d7053e79 100644
return v;
}
-@@ -5866,6 +5939,10 @@ var_list_t *append_var(var_list_t *list, var_t *var)
+@@ -5866,6 +5933,10 @@ var_list_t *append_var(var_list_t *list, var_t *var)
list_init( list );
}
list_add_tail( list, &var->entry );
@@ -5061,7 +5055,7 @@ index 6266e054..d7053e79 100644
return list;
}
-@@ -5885,11 +5962,11 @@ var_t *make_var(char *name)
+@@ -5885,11 +5956,11 @@ var_t *make_var(char *name)
{
var_t *v = xmalloc(sizeof(var_t));
v->name = name;
@@ -5075,7 +5069,7 @@ index 6266e054..d7053e79 100644
return v;
}
-@@ -5897,10 +5974,9 @@ static var_t *copy_var(var_t *src, char *name, map_attrs_filter_t attr_filter)
+@@ -5897,10 +5968,9 @@ static var_t *copy_var(var_t *src, char *name, map_attrs_filter_t attr_filter)
{
var_t *v = xmalloc(sizeof(var_t));
v->name = name;
@@ -5087,7 +5081,7 @@ index 6266e054..d7053e79 100644
v->loc_info = src->loc_info;
return v;
}
-@@ -5920,7 +5996,7 @@ static declarator_t *make_declarator(var_t *var)
+@@ -5920,7 +5990,7 @@ static declarator_t *make_declarator(var_t *var)
{
declarator_t *d = xmalloc(sizeof(*d));
d->var = var ? var : make_var(NULL);
@@ -5096,7 +5090,7 @@ index 6266e054..d7053e79 100644
d->func_type = NULL;
d->bits = NULL;
return d;
-@@ -5928,7 +6004,15 @@ static declarator_t *make_declarator(var_t *var)
+@@ -5928,7 +5998,15 @@ static declarator_t *make_declarator(var_t *var)
static type_t *make_safearray(type_t *type)
{
@@ -5113,16 +5107,7 @@ index 6266e054..d7053e79 100644
NULL, NULL, FC_RP);
}
-@@ -6007,6 +6091,8 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
- }
- if (!namespace)
- namespace = &global_namespace;
-+ printf("reg_type { name : %s, namespace : %s, type : %s, ptr : %p}\n", name, namespace->name, ts_to_str(t), type);
-+
- hash = hash_ident(name);
- nt = xmalloc(sizeof(struct rtype));
- nt->name = name;
-@@ -6018,15 +6104,16 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
+@@ -6018,15 +6096,16 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
nt->t = t;
nt->next = namespace->type_hash[hash];
namespace->type_hash[hash] = nt;
@@ -5142,7 +5127,7 @@ index 6266e054..d7053e79 100644
type_get_type_detect_alias(t) == TYPE_UNION ||
type_get_type_detect_alias(t) == TYPE_ENCAPSULATED_UNION);
}
-@@ -6034,19 +6121,16 @@ static int is_incomplete(const type_t *t)
+@@ -6034,19 +6113,16 @@ static int is_incomplete(const type_t *t)
void add_incomplete(type_t *t)
{
struct typenode *tn = xmalloc(sizeof *tn);
@@ -5166,7 +5151,7 @@ index 6266e054..d7053e79 100644
t->defined = ot->defined;
}
}
-@@ -6070,7 +6154,7 @@ static void fix_incomplete_types(type_t *complete_type)
+@@ -6070,7 +6146,7 @@ static void fix_incomplete_types(type_t *complete_type)
{
if (type_is_equal(complete_type, tn->type))
{
@@ -5175,7 +5160,7 @@ index 6266e054..d7053e79 100644
list_remove(&tn->entry);
free(tn);
}
-@@ -6094,7 +6178,13 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
+@@ -6094,7 +6170,13 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
type_get_type_detect_alias(type) == TYPE_ENCAPSULATED_UNION)
{
if (!type->name)
@@ -5189,13 +5174,7 @@ index 6266e054..d7053e79 100644
/* replace existing attributes when generating a typelib */
if (do_typelib)
-@@ -6120,12 +6210,12 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
- * for cleaner solution.
- */
- if (cur && input_name == cur->loc_info.input_name)
-- error_loc("%s: redefinition error; original definition was at %s:%d\n",
-+ error_loc("FOO %s: redefinition error; original definition was at %s:%d\n",
- cur->name, cur->loc_info.input_name,
+@@ -6125,7 +6207,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
cur->loc_info.line_number);
name = declare_var(attrs, decl_spec, decl, 0);
@@ -5204,16 +5183,7 @@ index 6266e054..d7053e79 100644
cur->attrs = attrs;
if (is_incomplete(cur))
-@@ -6140,6 +6230,8 @@ type_t *find_type(const char *name, struct namespace *namespace, int t)
- {
- struct rtype *cur;
-
-+ printf("find_type { name : %s, namespace %s, type : %s }\n", name, namespace ? namespace->name : NULL, ts_to_str(t));
-+
- if(namespace && namespace != &global_namespace) {
- for(cur = namespace->type_hash[hash_ident(name)]; cur; cur = cur->next) {
- if(cur->t == t && !strcmp(cur->name, name))
-@@ -6293,7 +6385,6 @@ struct allowed_attr allowed_attr[] =
+@@ -6293,7 +6375,6 @@ struct allowed_attr allowed_attr[] =
/* ATTR_CASE */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "case" },
/* ATTR_CODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" },
/* ATTR_COMMSTATUS */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "comm_status" },
@@ -5221,7 +5191,7 @@ index 6266e054..d7053e79 100644
/* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" },
/* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "control" },
/* ATTR_DECODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "decode" },
-@@ -6328,7 +6419,6 @@ struct allowed_attr allowed_attr[] =
+@@ -6328,7 +6409,6 @@ struct allowed_attr allowed_attr[] =
/* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "immediatebind" },
/* ATTR_IMPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "implicit_handle" },
/* ATTR_IN */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "in" },
@@ -5229,7 +5199,7 @@ index 6266e054..d7053e79 100644
/* ATTR_INPUTSYNC */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inputsync" },
/* ATTR_LENGTHIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, "length_is" },
/* ATTR_LIBLCID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "lcid" },
-@@ -6400,10 +6490,10 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
+@@ -6400,10 +6480,10 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
if (attr->type == ATTR_IMPLICIT_HANDLE)
{
const var_t *var = attr->u.pval;
@@ -5243,7 +5213,7 @@ index 6266e054..d7053e79 100644
continue;
error_loc("attribute %s requires a handle type in interface %s\n",
allowed_attr[attr->type].display_name, name);
-@@ -6608,7 +6698,7 @@ static int is_ptr_guid_type(const type_t *type)
+@@ -6608,7 +6688,7 @@ static int is_ptr_guid_type(const type_t *type)
/* second, make sure it is a pointer to something of size sizeof(GUID),
* i.e. 16 bytes */
@@ -5252,7 +5222,7 @@ index 6266e054..d7053e79 100644
}
static void check_conformance_expr_list(const char *attr_name, const var_t *arg, const type_t *container_type, expr_list_t *expr_list)
-@@ -6635,7 +6725,7 @@ static void check_remoting_fields(const var_t *var, type_t *type);
+@@ -6635,7 +6715,7 @@ static void check_remoting_fields(const var_t *var, type_t *type);
static void check_field_common(const type_t *container_type,
const char *container_name, const var_t *arg)
{
@@ -5261,7 +5231,7 @@ index 6266e054..d7053e79 100644
int more_to_do;
const char *container_type_name;
const char *var_type;
-@@ -6665,7 +6755,7 @@ static void check_field_common(const type_t *container_type,
+@@ -6665,7 +6745,7 @@ static void check_field_common(const type_t *container_type,
}
if (is_attr(arg->attrs, ATTR_LENGTHIS) &&
@@ -5270,7 +5240,7 @@ index 6266e054..d7053e79 100644
error_loc_info(&arg->loc_info,
"string and length_is specified for argument %s are mutually exclusive attributes\n",
arg->name);
-@@ -6762,23 +6852,28 @@ static void check_field_common(const type_t *container_type,
+@@ -6762,23 +6842,28 @@ static void check_field_common(const type_t *container_type,
{
const type_t *t = type;
while (is_ptr(t))
@@ -5303,7 +5273,7 @@ index 6266e054..d7053e79 100644
case TGT_RANGE:
/* nothing to do */
break;
-@@ -6803,13 +6898,18 @@ static void check_remoting_fields(const var_t *var, type_t *type)
+@@ -6803,13 +6888,18 @@ static void check_remoting_fields(const var_t *var, type_t *type)
if (type_is_complete(type))
fields = type_struct_get_fields(type);
else
@@ -5325,7 +5295,7 @@ index 6266e054..d7053e79 100644
}
/* checks that arguments for a function make sense for marshalling and unmarshalling */
-@@ -6818,9 +6918,10 @@ static void check_remoting_args(const var_t *func)
+@@ -6818,9 +6908,10 @@ static void check_remoting_args(const var_t *func)
const char *funcname = func->name;
const var_t *arg;
@@ -5338,7 +5308,7 @@ index 6266e054..d7053e79 100644
/* check that [out] parameters have enough pointer levels */
if (is_attr(arg->attrs, ATTR_OUT))
-@@ -6860,16 +6961,16 @@ static void check_remoting_args(const var_t *func)
+@@ -6860,16 +6951,16 @@ static void check_remoting_args(const var_t *func)
}
}
@@ -5359,7 +5329,7 @@ index 6266e054..d7053e79 100644
free(var.name);
}
}
-@@ -6886,8 +6987,8 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func)
+@@ -6886,8 +6977,8 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func)
* function */
var_t *idl_handle = make_var(xstrdup("IDL_handle"));
idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
@@ -5370,7 +5340,7 @@ index 6266e054..d7053e79 100644
}
}
-@@ -6952,6 +7053,7 @@ static void check_async_uuid(type_t *iface)
+@@ -6952,6 +7043,7 @@ static void check_async_uuid(type_t *iface)
type_t *async_iface;
type_t *inherit;
@@ -5378,7 +5348,7 @@ index 6266e054..d7053e79 100644
if (!is_attr(iface->attrs, ATTR_ASYNCUUID)) return;
inherit = iface->details.iface->inherit;
-@@ -6968,7 +7070,8 @@ static void check_async_uuid(type_t *iface)
+@@ -6968,7 +7060,8 @@ static void check_async_uuid(type_t *iface)
var_t *begin_func, *finish_func, *func = stmt->u.var, *arg;
var_list_t *begin_args = NULL, *finish_args = NULL, *args;
@@ -5388,7 +5358,7 @@ index 6266e054..d7053e79 100644
if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
{
if (is_attr(arg->attrs, ATTR_IN) || !is_attr(arg->attrs, ATTR_OUT))
-@@ -6978,15 +7081,15 @@ static void check_async_uuid(type_t *iface)
+@@ -6978,15 +7071,15 @@ static void check_async_uuid(type_t *iface)
}
begin_func = copy_var(func, concat_str("Begin_", func->name), NULL);
@@ -5410,7 +5380,7 @@ index 6266e054..d7053e79 100644
stmts = append_statement(stmts, make_statement_declaration(finish_func));
}
-@@ -7026,6 +7129,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar
+@@ -7026,6 +7119,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar
static void check_all_user_types(const statement_list_t *stmts)
{
const statement_t *stmt;
@@ -5418,7 +5388,7 @@ index 6266e054..d7053e79 100644
if (stmts) LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry)
{
-@@ -7037,7 +7141,11 @@ static void check_all_user_types(const statement_list_t *stmts)
+@@ -7037,7 +7131,11 @@ static void check_all_user_types(const statement_list_t *stmts)
const statement_t *stmt_func;
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type)) {
const var_t *func = stmt_func->u.var;
@@ -5431,7 +5401,7 @@ index 6266e054..d7053e79 100644
}
}
}
-@@ -7071,6 +7179,10 @@ static statement_t *make_statement_type_decl(type_t *type)
+@@ -7071,6 +7169,10 @@ static statement_t *make_statement_type_decl(type_t *type)
{
statement_t *stmt = make_statement(STMT_TYPE);
stmt->u.type = type;
@@ -5442,7 +5412,7 @@ index 6266e054..d7053e79 100644
return stmt;
}
-@@ -7085,16 +7197,16 @@ static statement_t *make_statement_declaration(var_t *var)
+@@ -7085,16 +7187,16 @@ static statement_t *make_statement_declaration(var_t *var)
{
statement_t *stmt = make_statement(STMT_DECLARATION);
stmt->u.var = var;
@@ -5462,7 +5432,7 @@ index 6266e054..d7053e79 100644
error_loc("instantiation of data is illegal\n");
return stmt;
}
-@@ -7146,6 +7258,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
+@@ -7146,6 +7248,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
declarator_t *decl, *next;
statement_t *stmt;
type_list_t **type_list;
@@ -5470,7 +5440,7 @@ index 6266e054..d7053e79 100644
if (!decls) return NULL;
-@@ -7157,6 +7270,18 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
+@@ -7157,6 +7260,18 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
{
var_t *var = decl->var;
type_t *type = find_type_or_error(var->name, 0);
@@ -5489,7 +5459,7 @@ index 6266e054..d7053e79 100644
*type_list = xmalloc(sizeof(type_list_t));
(*type_list)->type = type;
(*type_list)->next = NULL;
-@@ -7166,6 +7291,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
+@@ -7166,6 +7281,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
free(var);
}
@@ -5497,14 +5467,13 @@ index 6266e054..d7053e79 100644
return stmt;
}
-@@ -7206,7 +7332,7 @@ void init_loc_info(loc_info_t *i)
+@@ -7206,7 +7322,7 @@ void init_loc_info(loc_info_t *i)
static void check_def(const type_t *t)
{
- if (t->defined)
-- error_loc("%s: redefinition error; original definition was at %s:%d\n",
+ if (type_is_defined(t))
-+ error_loc("BAR %s: redefinition error; original definition was at %s:%d\n",
+ error_loc("%s: redefinition error; original definition was at %s:%d\n",
t->name, t->loc_info.input_name, t->loc_info.line_number);
}
diff --git a/mingw-w64-tools/widl/src/parser.tab.h b/mingw-w64-tools/widl/src/parser.tab.h
@@ -5544,7 +5513,7 @@ index 09874726..fc7a8f4d 100644
typedef union YYSTYPE YYSTYPE;
diff --git a/mingw-w64-tools/widl/src/parser.y b/mingw-w64-tools/widl/src/parser.y
-index d9793941..bb14bf76 100644
+index d9793941..64503ac1 100644
--- a/mingw-w64-tools/widl/src/parser.y
+++ b/mingw-w64-tools/widl/src/parser.y
@@ -52,13 +52,6 @@ struct _import_t
@@ -6008,7 +5977,7 @@ index d9793941..bb14bf76 100644
int top)
{
var_t *v = decl->var;
-@@ -1523,58 +1573,80 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -1523,58 +1573,74 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
expr_t *dim;
type_t **ptype;
type_t *func_type = decl ? decl->func_type : NULL;
@@ -6091,12 +6060,6 @@ index d9793941..bb14bf76 100644
- if (!ptr_attr && top && (*pt)->details.pointer.def_fc != FC_RP)
+ if (!ptr_attr && top && type_pointer_get_default_fc(*pt) != FC_RP)
{
-+ printf("dup_pointer_type!\n");
-+ printf("type : %p name : %s\n", *pt, (*pt)->name);
-+ /* ptr_attr is ref,unique or full (FC_RP, FC_UP, FC_FP) */
-+ /* *pt could be the var's declspec's type OR a type on a typedef */
-+ /* not an array */
-+
/* FIXME: this is a horrible hack to cope with the issue that we
* store an offset to the typeformat string in the type object, but
* two typeformat strings may be written depending on whether the
@@ -6106,7 +6069,7 @@ index d9793941..bb14bf76 100644
}
}
else if (ptr_attr)
-@@ -1585,16 +1657,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -1585,16 +1651,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
{
type_t *t = type;
@@ -6126,7 +6089,7 @@ index d9793941..bb14bf76 100644
else
break;
}
-@@ -1611,15 +1683,15 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -1611,15 +1677,15 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
if (is_attr(v->attrs, ATTR_V1ENUM))
{
@@ -6145,7 +6108,7 @@ index d9793941..bb14bf76 100644
if (sizes) LIST_FOR_EACH_ENTRY(dim, sizes, expr_t, entry)
{
if (dim->type != EXPR_VOID)
-@@ -1632,7 +1704,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -1632,7 +1698,7 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
else
*ptype = type_new_array((*ptype)->name,
type_array_get_element(*ptype), FALSE,
@@ -6154,7 +6117,7 @@ index d9793941..bb14bf76 100644
}
else if (is_ptr(*ptype))
*ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), TRUE,
-@@ -1641,15 +1713,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -1641,15 +1707,16 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
error_loc("%s: size_is attribute applied to illegal type\n", v->name);
}
@@ -6174,7 +6137,7 @@ index d9793941..bb14bf76 100644
if (lengs) LIST_FOR_EACH_ENTRY(dim, lengs, expr_t, entry)
{
if (dim->type != EXPR_VOID)
-@@ -1667,10 +1740,11 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -1667,10 +1734,11 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
error_loc("%s: length_is attribute applied to illegal type\n", v->name);
}
@@ -6188,7 +6151,7 @@ index d9793941..bb14bf76 100644
else
error_loc("%s: too many expressions in length_is attribute\n", v->name);
}
-@@ -1681,29 +1755,31 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
+@@ -1681,29 +1749,31 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
if (func_type)
{
type_t *ft, *t;
@@ -6229,7 +6192,7 @@ index d9793941..bb14bf76 100644
return v;
}
-@@ -1751,6 +1827,10 @@ var_list_t *append_var(var_list_t *list, var_t *var)
+@@ -1751,6 +1821,10 @@ var_list_t *append_var(var_list_t *list, var_t *var)
list_init( list );
}
list_add_tail( list, &var->entry );
@@ -6240,7 +6203,7 @@ index d9793941..bb14bf76 100644
return list;
}
-@@ -1770,11 +1850,11 @@ var_t *make_var(char *name)
+@@ -1770,11 +1844,11 @@ var_t *make_var(char *name)
{
var_t *v = xmalloc(sizeof(var_t));
v->name = name;
@@ -6254,7 +6217,7 @@ index d9793941..bb14bf76 100644
return v;
}
-@@ -1782,10 +1862,9 @@ static var_t *copy_var(var_t *src, char *name, map_attrs_filter_t attr_filter)
+@@ -1782,10 +1856,9 @@ static var_t *copy_var(var_t *src, char *name, map_attrs_filter_t attr_filter)
{
var_t *v = xmalloc(sizeof(var_t));
v->name = name;
@@ -6266,7 +6229,7 @@ index d9793941..bb14bf76 100644
v->loc_info = src->loc_info;
return v;
}
-@@ -1805,7 +1884,7 @@ static declarator_t *make_declarator(var_t *var)
+@@ -1805,7 +1878,7 @@ static declarator_t *make_declarator(var_t *var)
{
declarator_t *d = xmalloc(sizeof(*d));
d->var = var ? var : make_var(NULL);
@@ -6275,7 +6238,7 @@ index d9793941..bb14bf76 100644
d->func_type = NULL;
d->bits = NULL;
return d;
-@@ -1813,7 +1892,15 @@ static declarator_t *make_declarator(var_t *var)
+@@ -1813,7 +1886,15 @@ static declarator_t *make_declarator(var_t *var)
static type_t *make_safearray(type_t *type)
{
@@ -6292,16 +6255,7 @@ index d9793941..bb14bf76 100644
NULL, NULL, FC_RP);
}
-@@ -1892,6 +1979,8 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
- }
- if (!namespace)
- namespace = &global_namespace;
-+ printf("reg_type { name : %s, namespace : %s, type : %s, ptr : %p}\n", name, namespace->name, ts_to_str(t), type);
-+
- hash = hash_ident(name);
- nt = xmalloc(sizeof(struct rtype));
- nt->name = name;
-@@ -1903,15 +1992,16 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
+@@ -1903,15 +1984,16 @@ type_t *reg_type(type_t *type, const char *name, struct namespace *namespace, in
nt->t = t;
nt->next = namespace->type_hash[hash];
namespace->type_hash[hash] = nt;
@@ -6321,7 +6275,7 @@ index d9793941..bb14bf76 100644
type_get_type_detect_alias(t) == TYPE_UNION ||
type_get_type_detect_alias(t) == TYPE_ENCAPSULATED_UNION);
}
-@@ -1919,19 +2009,16 @@ static int is_incomplete(const type_t *t)
+@@ -1919,19 +2001,16 @@ static int is_incomplete(const type_t *t)
void add_incomplete(type_t *t)
{
struct typenode *tn = xmalloc(sizeof *tn);
@@ -6345,7 +6299,7 @@ index d9793941..bb14bf76 100644
t->defined = ot->defined;
}
}
-@@ -1955,7 +2042,7 @@ static void fix_incomplete_types(type_t *complete_type)
+@@ -1955,7 +2034,7 @@ static void fix_incomplete_types(type_t *complete_type)
{
if (type_is_equal(complete_type, tn->type))
{
@@ -6354,7 +6308,7 @@ index d9793941..bb14bf76 100644
list_remove(&tn->entry);
free(tn);
}
-@@ -1979,7 +2066,13 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
+@@ -1979,7 +2058,13 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
type_get_type_detect_alias(type) == TYPE_ENCAPSULATED_UNION)
{
if (!type->name)
@@ -6368,13 +6322,7 @@ index d9793941..bb14bf76 100644
/* replace existing attributes when generating a typelib */
if (do_typelib)
-@@ -2005,12 +2098,12 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
- * for cleaner solution.
- */
- if (cur && input_name == cur->loc_info.input_name)
-- error_loc("%s: redefinition error; original definition was at %s:%d\n",
-+ error_loc("FOO %s: redefinition error; original definition was at %s:%d\n",
- cur->name, cur->loc_info.input_name,
+@@ -2010,7 +2095,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
cur->loc_info.line_number);
name = declare_var(attrs, decl_spec, decl, 0);
@@ -6383,16 +6331,7 @@ index d9793941..bb14bf76 100644
cur->attrs = attrs;
if (is_incomplete(cur))
-@@ -2025,6 +2118,8 @@ type_t *find_type(const char *name, struct namespace *namespace, int t)
- {
- struct rtype *cur;
-
-+ printf("find_type { name : %s, namespace %s, type : %s }\n", name, namespace ? namespace->name : NULL, ts_to_str(t));
-+
- if(namespace && namespace != &global_namespace) {
- for(cur = namespace->type_hash[hash_ident(name)]; cur; cur = cur->next) {
- if(cur->t == t && !strcmp(cur->name, name))
-@@ -2178,7 +2273,6 @@ struct allowed_attr allowed_attr[] =
+@@ -2178,7 +2263,6 @@ struct allowed_attr allowed_attr[] =
/* ATTR_CASE */ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "case" },
/* ATTR_CODE */ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "code" },
/* ATTR_COMMSTATUS */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "comm_status" },
@@ -6400,7 +6339,7 @@ index d9793941..bb14bf76 100644
/* ATTR_CONTEXTHANDLE */ { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "context_handle" },
/* ATTR_CONTROL */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, "control" },
/* ATTR_DECODE */ { 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, "decode" },
-@@ -2213,7 +2307,6 @@ struct allowed_attr allowed_attr[] =
+@@ -2213,7 +2297,6 @@ struct allowed_attr allowed_attr[] =
/* ATTR_IMMEDIATEBIND */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "immediatebind" },
/* ATTR_IMPLICIT_HANDLE */ { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "implicit_handle" },
/* ATTR_IN */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "in" },
@@ -6408,7 +6347,7 @@ index d9793941..bb14bf76 100644
/* ATTR_INPUTSYNC */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "inputsync" },
/* ATTR_LENGTHIS */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, "length_is" },
/* ATTR_LIBLCID */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "lcid" },
-@@ -2285,10 +2378,10 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
+@@ -2285,10 +2368,10 @@ static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
if (attr->type == ATTR_IMPLICIT_HANDLE)
{
const var_t *var = attr->u.pval;
@@ -6422,7 +6361,7 @@ index d9793941..bb14bf76 100644
continue;
error_loc("attribute %s requires a handle type in interface %s\n",
allowed_attr[attr->type].display_name, name);
-@@ -2493,7 +2586,7 @@ static int is_ptr_guid_type(const type_t *type)
+@@ -2493,7 +2576,7 @@ static int is_ptr_guid_type(const type_t *type)
/* second, make sure it is a pointer to something of size sizeof(GUID),
* i.e. 16 bytes */
@@ -6431,7 +6370,7 @@ index d9793941..bb14bf76 100644
}
static void check_conformance_expr_list(const char *attr_name, const var_t *arg, const type_t *container_type, expr_list_t *expr_list)
-@@ -2520,7 +2613,7 @@ static void check_remoting_fields(const var_t *var, type_t *type);
+@@ -2520,7 +2603,7 @@ static void check_remoting_fields(const var_t *var, type_t *type);
static void check_field_common(const type_t *container_type,
const char *container_name, const var_t *arg)
{
@@ -6440,7 +6379,7 @@ index d9793941..bb14bf76 100644
int more_to_do;
const char *container_type_name;
const char *var_type;
-@@ -2550,7 +2643,7 @@ static void check_field_common(const type_t *container_type,
+@@ -2550,7 +2633,7 @@ static void check_field_common(const type_t *container_type,
}
if (is_attr(arg->attrs, ATTR_LENGTHIS) &&
@@ -6449,7 +6388,7 @@ index d9793941..bb14bf76 100644
error_loc_info(&arg->loc_info,
"string and length_is specified for argument %s are mutually exclusive attributes\n",
arg->name);
-@@ -2647,23 +2740,28 @@ static void check_field_common(const type_t *container_type,
+@@ -2647,23 +2730,28 @@ static void check_field_common(const type_t *container_type,
{
const type_t *t = type;
while (is_ptr(t))
@@ -6482,7 +6421,7 @@ index d9793941..bb14bf76 100644
case TGT_RANGE:
/* nothing to do */
break;
-@@ -2688,13 +2786,18 @@ static void check_remoting_fields(const var_t *var, type_t *type)
+@@ -2688,13 +2776,18 @@ static void check_remoting_fields(const var_t *var, type_t *type)
if (type_is_complete(type))
fields = type_struct_get_fields(type);
else
@@ -6504,7 +6443,7 @@ index d9793941..bb14bf76 100644
}
/* checks that arguments for a function make sense for marshalling and unmarshalling */
-@@ -2703,9 +2806,10 @@ static void check_remoting_args(const var_t *func)
+@@ -2703,9 +2796,10 @@ static void check_remoting_args(const var_t *func)
const char *funcname = func->name;
const var_t *arg;
@@ -6517,7 +6456,7 @@ index d9793941..bb14bf76 100644
/* check that [out] parameters have enough pointer levels */
if (is_attr(arg->attrs, ATTR_OUT))
-@@ -2745,16 +2849,16 @@ static void check_remoting_args(const var_t *func)
+@@ -2745,16 +2839,16 @@ static void check_remoting_args(const var_t *func)
}
}
@@ -6538,7 +6477,7 @@ index d9793941..bb14bf76 100644
free(var.name);
}
}
-@@ -2771,8 +2875,8 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func)
+@@ -2771,8 +2865,8 @@ static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func)
* function */
var_t *idl_handle = make_var(xstrdup("IDL_handle"));
idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
@@ -6549,7 +6488,7 @@ index d9793941..bb14bf76 100644
}
}
-@@ -2837,6 +2941,7 @@ static void check_async_uuid(type_t *iface)
+@@ -2837,6 +2931,7 @@ static void check_async_uuid(type_t *iface)
type_t *async_iface;
type_t *inherit;
@@ -6557,7 +6496,7 @@ index d9793941..bb14bf76 100644
if (!is_attr(iface->attrs, ATTR_ASYNCUUID)) return;
inherit = iface->details.iface->inherit;
-@@ -2853,7 +2958,8 @@ static void check_async_uuid(type_t *iface)
+@@ -2853,7 +2948,8 @@ static void check_async_uuid(type_t *iface)
var_t *begin_func, *finish_func, *func = stmt->u.var, *arg;
var_list_t *begin_args = NULL, *finish_args = NULL, *args;
@@ -6567,7 +6506,7 @@ index d9793941..bb14bf76 100644
if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
{
if (is_attr(arg->attrs, ATTR_IN) || !is_attr(arg->attrs, ATTR_OUT))
-@@ -2863,15 +2969,15 @@ static void check_async_uuid(type_t *iface)
+@@ -2863,15 +2959,15 @@ static void check_async_uuid(type_t *iface)
}
begin_func = copy_var(func, concat_str("Begin_", func->name), NULL);
@@ -6589,7 +6528,7 @@ index d9793941..bb14bf76 100644
stmts = append_statement(stmts, make_statement_declaration(finish_func));
}
-@@ -2911,6 +3017,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar
+@@ -2911,6 +3007,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar
static void check_all_user_types(const statement_list_t *stmts)
{
const statement_t *stmt;
@@ -6597,7 +6536,7 @@ index d9793941..bb14bf76 100644
if (stmts) LIST_FOR_EACH_ENTRY(stmt, stmts, const statement_t, entry)
{
-@@ -2922,7 +3029,11 @@ static void check_all_user_types(const statement_list_t *stmts)
+@@ -2922,7 +3019,11 @@ static void check_all_user_types(const statement_list_t *stmts)
const statement_t *stmt_func;
STATEMENTS_FOR_EACH_FUNC(stmt_func, type_iface_get_stmts(stmt->u.type)) {
const var_t *func = stmt_func->u.var;
@@ -6610,7 +6549,7 @@ index d9793941..bb14bf76 100644
}
}
}
-@@ -2956,6 +3067,10 @@ static statement_t *make_statement_type_decl(type_t *type)
+@@ -2956,6 +3057,10 @@ static statement_t *make_statement_type_decl(type_t *type)
{
statement_t *stmt = make_statement(STMT_TYPE);
stmt->u.type = type;
@@ -6621,7 +6560,7 @@ index d9793941..bb14bf76 100644
return stmt;
}
-@@ -2970,16 +3085,16 @@ static statement_t *make_statement_declaration(var_t *var)
+@@ -2970,16 +3075,16 @@ static statement_t *make_statement_declaration(var_t *var)
{
statement_t *stmt = make_statement(STMT_DECLARATION);
stmt->u.var = var;
@@ -6641,7 +6580,7 @@ index d9793941..bb14bf76 100644
error_loc("instantiation of data is illegal\n");
return stmt;
}
-@@ -3031,6 +3146,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
+@@ -3031,6 +3136,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
declarator_t *decl, *next;
statement_t *stmt;
type_list_t **type_list;
@@ -6649,7 +6588,7 @@ index d9793941..bb14bf76 100644
if (!decls) return NULL;
-@@ -3042,6 +3158,18 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
+@@ -3042,6 +3148,18 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
{
var_t *var = decl->var;
type_t *type = find_type_or_error(var->name, 0);
@@ -6668,7 +6607,7 @@ index d9793941..bb14bf76 100644
*type_list = xmalloc(sizeof(type_list_t));
(*type_list)->type = type;
(*type_list)->next = NULL;
-@@ -3051,6 +3179,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
+@@ -3051,6 +3169,7 @@ static statement_t *make_statement_typedef(declarator_list_t *decls)
free(var);
}
@@ -6676,14 +6615,13 @@ index d9793941..bb14bf76 100644
return stmt;
}
-@@ -3091,7 +3220,7 @@ void init_loc_info(loc_info_t *i)
+@@ -3091,7 +3210,7 @@ void init_loc_info(loc_info_t *i)
static void check_def(const type_t *t)
{
- if (t->defined)
-- error_loc("%s: redefinition error; original definition was at %s:%d\n",
+ if (type_is_defined(t))
-+ error_loc("BAR %s: redefinition error; original definition was at %s:%d\n",
+ error_loc("%s: redefinition error; original definition was at %s:%d\n",
t->name, t->loc_info.input_name, t->loc_info.line_number);
}
diff --git a/mingw-w64-tools/widl/src/parser.yy.c b/mingw-w64-tools/widl/src/parser.yy.c
@@ -9337,7 +9275,7 @@ index 9b1de2c8..2c2b1276 100644
return VT_PTR;
}
diff --git a/mingw-w64-tools/widl/src/typetree.c b/mingw-w64-tools/widl/src/typetree.c
-index b93806be..f52b785f 100644
+index b93806be..488f7a49 100644
--- a/mingw-w64-tools/widl/src/typetree.c
+++ b/mingw-w64-tools/widl/src/typetree.c
@@ -30,12 +30,16 @@
@@ -9386,7 +9324,7 @@ index b93806be..f52b785f 100644
error_loc("argument '%s' has void type\n", arg->name);
if (!arg->name)
{
-@@ -178,35 +181,29 @@ type_t *type_new_function(var_list_t *args)
+@@ -178,34 +181,28 @@ type_t *type_new_function(var_list_t *args)
return t;
}
@@ -9423,23 +9361,20 @@ index b93806be..f52b785f 100644
{
type_t *type = get_type(TYPE_MODULE, name, NULL, 0);
- if (type->type_type != TYPE_MODULE || type->defined)
-- error_loc("%s: redefinition error; original definition was at %s:%d\n",
+ if (type->type_type != TYPE_MODULE || type_is_defined(type))
-+ error_loc("BAZ %s: redefinition error; original definition was at %s:%d\n",
+ error_loc("%s: redefinition error; original definition was at %s:%d\n",
type->name, type->loc_info.input_name, type->loc_info.line_number);
type->name = name;
- return type;
-@@ -215,15 +212,15 @@ type_t *type_new_module(char *name)
+@@ -215,7 +212,7 @@ type_t *type_new_module(char *name)
type_t *type_new_coclass(char *name)
{
type_t *type = get_type(TYPE_COCLASS, name, NULL, 0);
- if (type->type_type != TYPE_COCLASS || type->defined)
-- error_loc("%s: redefinition error; original definition was at %s:%d\n",
+ if (type->type_type != TYPE_COCLASS || type_is_defined(type))
-+ error_loc("BING %s: redefinition error; original definition was at %s:%d\n",
+ error_loc("%s: redefinition error; original definition was at %s:%d\n",
type->name, type->loc_info.input_name, type->loc_info.line_number);
type->name = name;
- return type;
+@@ -223,7 +220,7 @@ type_t *type_new_coclass(char *name)
}
@@ -10078,7 +10013,7 @@ index 118e2245..4f4252e3 100644
{
MODE_Os, /* inline stubs */
diff --git a/mingw-w64-tools/widl/src/widltypes.h b/mingw-w64-tools/widl/src/widltypes.h
-index 08584de5..b9c5a07d 100644
+index 08584de5..cd71e9af 100644
--- a/mingw-w64-tools/widl/src/widltypes.h
+++ b/mingw-w64-tools/widl/src/widltypes.h
@@ -40,6 +40,7 @@ typedef struct _attr_t attr_t;
@@ -10279,20 +10214,7 @@ index 08584de5..b9c5a07d 100644
void init_types(void);
type_t *alloc_type(void);
-@@ -568,6 +607,12 @@ void clear_all_offsets(void);
- #define tsSTRUCT 2
- #define tsUNION 3
-
-+static inline const char* ts_to_str(int t)
-+{
-+ static const char* strings[] = {"tsNULL", "tsENUM", "tsSTRUCT", "tsUNION"};
-+ return strings[t];
-+}
-+
- var_t *find_const(const char *name, int f);
- type_t *find_type(const char *name, struct namespace *namespace, int t);
- type_t *make_type(enum type_type type);
-@@ -582,38 +627,18 @@ void init_loc_info(loc_info_t *);
+@@ -582,38 +621,18 @@ void init_loc_info(loc_info_t *);
char *format_namespace(struct namespace *namespace, const char *prefix, const char *separator, const char *suffix);
1
0
[tor-browser-build/master] Merge remote-tracking branch 'boklm/bug_30549_v6'
by gk@torproject.org 08 Jul '19
by gk@torproject.org 08 Jul '19
08 Jul '19
commit 1ece76a456213a16f23b41a6ce133a44a0302ee0
Merge: fdd4aaf cd6555a
Author: Georg Koppen <gk(a)torproject.org>
Date: Mon Jul 8 06:39:15 2019 +0000
Merge remote-tracking branch 'boklm/bug_30549_v6'
tools/keyring/drop-expired-sub-keys | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
1
0
[tor-browser-build/master] Bug 30549: Avoid using keybox format in drop-expired-sub-keys
by gk@torproject.org 08 Jul '19
by gk@torproject.org 08 Jul '19
08 Jul '19
commit cd6555af118fa06a30d54a491618b50c5d463c5d
Author: Nicolas Vigier <boklm(a)torproject.org>
Date: Fri Jul 5 17:53:10 2019 +0200
Bug 30549: Avoid using keybox format in drop-expired-sub-keys
When creating a new keyring with gpg >= 2.1, it will be created in the
keybox format, which is only compatible with gpg >= 2.1. This means that
the drop-expired-sub-keys script will create keyring files which are not
compatible with older versions of gpg.
To avoid this, we use the output of gpg --export as the keyring file,
which is in the old format.
---
tools/keyring/drop-expired-sub-keys | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/keyring/drop-expired-sub-keys b/tools/keyring/drop-expired-sub-keys
index e7bbe50..f041746 100755
--- a/tools/keyring/drop-expired-sub-keys
+++ b/tools/keyring/drop-expired-sub-keys
@@ -16,7 +16,5 @@ set -e
keyring="$1"
test -f "$keyring"
tmpfile=$(mktemp)
-gpg --no-auto-check-trustdb --no-default-keyring --keyring "$keyring" --armor --export-options export-clean --export-filter 'drop-subkey=expired -t || revoked -t' --export > "$tmpfile"
-rm -f "$keyring"
-gpg --no-auto-check-trustdb --trust-model always --no-default-keyring --keyring "$keyring" --import "$tmpfile"
-rm -f "$tmpfile"
+gpg --no-auto-check-trustdb --no-default-keyring --keyring "$keyring" --export-options export-clean --export-filter 'drop-subkey=expired -t || revoked -t' --export > "$tmpfile"
+mv -f "$tmpfile" "$keyring"
1
0
commit fdd4aaf53b5c772fa71a951231ea50a41d00c583
Author: Georg Koppen <gk(a)torproject.org>
Date: Sat Jul 6 06:47:23 2019 +0000
Using build2 for 9.0a4
---
rbm.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rbm.conf b/rbm.conf
index ff4169c..4f6e943 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -25,7 +25,7 @@ buildconf:
var:
torbrowser_version: '9.0a4'
- torbrowser_build: 'build1'
+ torbrowser_build: 'build2'
torbrowser_incremental_from:
- 9.0a3
project_name: tor-browser
1
0
commit 15d7d2311bfc238b7f16f486348d84fc52b054af
Author: Georg Koppen <gk(a)torproject.org>
Date: Sat Jul 6 06:52:44 2019 +0000
Pick up arch64 properly
---
projects/release/config | 2 ++
1 file changed, 2 insertions(+)
diff --git a/projects/release/config b/projects/release/config
index 1623083..0133c3f 100644
--- a/projects/release/config
+++ b/projects/release/config
@@ -17,6 +17,7 @@ targets:
- torbrowser-osx-x86_64
- torbrowser-android-armv7
- torbrowser-android-x86
+ - torbrowser-android-aarch64
- torbrowser-src
torbrowser-android-armv7:
var:
@@ -124,6 +125,7 @@ input_files:
project: tor-browser
enable: '[% c("var/torbrowser-android-aarch64") %]'
target:
+ - '[% c("var/containers_target") %]'
- '[% c("var/build_target") %]'
- torbrowser-android-aarch64
1
0
04 Jul '19
commit 864378b92afcfdee80c2a79f6ec2e3d5c2d2fbc7
Author: Georg Koppen <gk(a)torproject.org>
Date: Thu Jul 4 20:26:50 2019 +0000
Release preparations for 9.0a4
Versions bump and Changelog update
---
projects/firefox/config | 4 ++--
projects/https-everywhere/config | 2 +-
.../tor-browser/Bundle-Data/Docs/ChangeLog.txt | 27 ++++++++++++++++++++++
projects/tor-launcher/config | 2 +-
projects/tor/config | 2 +-
projects/torbutton/config | 2 +-
rbm.conf | 6 ++---
7 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/projects/firefox/config b/projects/firefox/config
index 20c5b0f..9565b8e 100644
--- a/projects/firefox/config
+++ b/projects/firefox/config
@@ -1,14 +1,14 @@
# vim: filetype=yaml sw=2
version: '[% c("abbrev") %]'
filename: 'firefox-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %]'
-git_hash: 'tor-browser-[% c("var/firefox_version") %]-[% c("var/torbrowser_branch") %]-2-build2'
+git_hash: 'tor-browser-[% c("var/firefox_version") %]-[% c("var/torbrowser_branch") %]-1-build1'
tag_gpg_id: 1
git_url: https://git.torproject.org/tor-browser.git
git_submodule: 1
gpg_keyring: torbutton.gpg
var:
- firefox_platform_version: 60.7.0
+ firefox_platform_version: 60.8.0
firefox_version: '[% c("var/firefox_platform_version") %]esr'
torbrowser_branch: 9.0
torbrowser_update_channel: alpha
diff --git a/projects/https-everywhere/config b/projects/https-everywhere/config
index 2db9177..6232669 100644
--- a/projects/https-everywhere/config
+++ b/projects/https-everywhere/config
@@ -1,5 +1,5 @@
# vim: filetype=yaml sw=2
-version: 2019.5.13
+version: 2019.6.27
git_url: https://git.torproject.org/https-everywhere.git
git_hash: '[% c("version") %]'
git_submodule: 1
diff --git a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
index 37e89a2..5a1a67a 100644
--- a/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
+++ b/projects/tor-browser/Bundle-Data/Docs/ChangeLog.txt
@@ -1,3 +1,30 @@
+Tor Browser 9.0a4 -- July 9 2019
+ * All platforms
+ * Update Firefox to 60.8.0esr
+ * Update Torbutton to 2.2.1
+ * Bug 30577: Add Fundraising Banner
+ * Bug 31041: Stop syncing network.cookie.lifetimePolicy
+ * Bug 30468: Add mk locale
+ * Translations update
+ * Update Tor Launcher to 0.2.19.2
+ * Bug 30468: Add mk locale
+ * Translations update
+ * Update HTTPS Everywhere to 2019.6.27
+ * Bug 31055+31058: Remove four default bridges
+ * Bug 30849: Backport fixes for Mozilla's bug 1552627 and 1549833
+ * Windows + OS X + Linux
+ * Update Tor to 0.4.1.3-alpha
+ * Bug 30468: Add mk locale
+ * Bug 31059: Enable Letterboxing
+ * Windows
+ * Bug 27503: Provide full support for accessibility tools
+ * Bug 30575: Don't allow enterprise policies in Tor Browser
+ * OS X
+ * Bug 30631: Blurry Tor Browser icon on macOS app switcher
+ * Android
+ * Bug 28119: Tor Browser for aarch64
+ * Bug 30573: Sanitize old tabs and wait for tor before opening new tabs
+
Tor Browser 9.0a3 -- June 24 2019
* All platforms
* Pick up fixes for Mozilla's bug 1544386 and 1560192
diff --git a/projects/tor-launcher/config b/projects/tor-launcher/config
index 9bf886a..273c466 100644
--- a/projects/tor-launcher/config
+++ b/projects/tor-launcher/config
@@ -1,5 +1,5 @@
# vim: filetype=yaml sw=2
-version: 0.2.19.1
+version: 0.2.19.2
git_url: https://git.torproject.org/tor-launcher.git
git_hash: '[% c("version") %]'
gpg_keyring: torbutton.gpg
diff --git a/projects/tor/config b/projects/tor/config
index 6f4b5f2..35b37ce 100644
--- a/projects/tor/config
+++ b/projects/tor/config
@@ -1,6 +1,6 @@
# vim: filetype=yaml sw=2
filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %]'
-version: 0.4.1.2-alpha
+version: 0.4.1.3-alpha
git_hash: 'tor-[% c("version") %]'
git_url: https://git.torproject.org/tor.git
git_submodule: 1
diff --git a/projects/torbutton/config b/projects/torbutton/config
index ae3f915..1e37b80 100644
--- a/projects/torbutton/config
+++ b/projects/torbutton/config
@@ -1,5 +1,5 @@
# vim: filetype=yaml sw=2
-version: 2.2
+version: 2.2.1
git_url: https://git.torproject.org/torbutton.git
git_hash: '[% c("version") %]'
gpg_keyring: torbutton.gpg
diff --git a/rbm.conf b/rbm.conf
index 1a1570b..ff4169c 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -24,10 +24,10 @@ buildconf:
git_signtag_opt: '-s'
var:
- torbrowser_version: '9.0a3'
- torbrowser_build: 'build3'
+ torbrowser_version: '9.0a4'
+ torbrowser_build: 'build1'
torbrowser_incremental_from:
- - 9.0a2
+ - 9.0a3
project_name: tor-browser
multi_lingual: 0
build_mar: 1
1
0