Update Buildroot to 2019.02.3 (#415)
* Update Buildroot to 2019-02.3 * Fix enter script * Update ova_defconfig * Fix network manager * Remove runc patches * Use same docker version * Fix build * Fix vmtools * Fix depens * Fix handling with tempfiles * Fix permission handling * Fix cp * Cleanup * Fix mounts
This commit is contained in:
@@ -0,0 +1,294 @@
|
||||
From 0dbdfb7918d0b0cfcb8883b24c1291574bf5bb7c Mon Sep 17 00:00:00 2001
|
||||
From: Max Filippov <jcmvbkbc@gmail.com>
|
||||
Date: Tue, 2 Apr 2019 14:32:42 -0700
|
||||
Subject: [PATCH] gas: use literals/const16 for xtensa loop relaxation
|
||||
|
||||
Loop opcode relaxation that uses addi/addmi doesn't work well with other
|
||||
relaxations that may cause code movement. Instead of encoding fixed loop
|
||||
end offset in the relaxed sequence use l32r or a pair of const16 to load
|
||||
loop end address. This way the address of the loop end gets a relocation
|
||||
record and it gets updated appropriately.
|
||||
|
||||
gas/
|
||||
2019-04-02 Max Filippov <jcmvbkbc@gmail.com>
|
||||
|
||||
* config/tc-xtensa.c (convert_frag_immed): Drop
|
||||
convert_frag_immed_finish_loop invocation.
|
||||
(convert_frag_immed_finish_loop): Drop declaration and
|
||||
definition.
|
||||
* config/xtensa-relax.c (widen_spec_list): Replace loop
|
||||
widening that uses addi/addmi with widening that uses l32r
|
||||
and const16.
|
||||
|
||||
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
||||
---
|
||||
gas/config/tc-xtensa.c | 120 ----------------------------------------------
|
||||
gas/config/xtensa-relax.c | 77 ++++++++++++++++++++---------
|
||||
2 files changed, 55 insertions(+), 142 deletions(-)
|
||||
|
||||
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
|
||||
index 3bdbbc931cfc..0cc06361cf6f 100644
|
||||
--- a/gas/config/tc-xtensa.c
|
||||
+++ b/gas/config/tc-xtensa.c
|
||||
@@ -10668,7 +10668,6 @@ convert_frag_fill_nop (fragS *fragP)
|
||||
static fixS *fix_new_exp_in_seg
|
||||
(segT, subsegT, fragS *, int, int, expressionS *, int,
|
||||
bfd_reloc_code_real_type);
|
||||
-static void convert_frag_immed_finish_loop (segT, fragS *, TInsn *);
|
||||
|
||||
static void
|
||||
convert_frag_immed (segT segP,
|
||||
@@ -10910,9 +10909,6 @@ convert_frag_immed (segT segP,
|
||||
}
|
||||
}
|
||||
|
||||
- if (expanded && xtensa_opcode_is_loop (isa, orig_tinsn.opcode) == 1)
|
||||
- convert_frag_immed_finish_loop (segP, fragP, &orig_tinsn);
|
||||
-
|
||||
if (expanded && is_direct_call_opcode (orig_tinsn.opcode))
|
||||
{
|
||||
/* Add an expansion note on the expanded instruction. */
|
||||
@@ -10949,122 +10945,6 @@ fix_new_exp_in_seg (segT new_seg,
|
||||
}
|
||||
|
||||
|
||||
-/* Relax a loop instruction so that it can span loop >256 bytes.
|
||||
-
|
||||
- loop as, .L1
|
||||
- .L0:
|
||||
- rsr as, LEND
|
||||
- wsr as, LBEG
|
||||
- addi as, as, lo8 (label-.L1)
|
||||
- addmi as, as, mid8 (label-.L1)
|
||||
- wsr as, LEND
|
||||
- isync
|
||||
- rsr as, LCOUNT
|
||||
- addi as, as, 1
|
||||
- .L1:
|
||||
- <<body>>
|
||||
- label:
|
||||
-*/
|
||||
-
|
||||
-static void
|
||||
-convert_frag_immed_finish_loop (segT segP, fragS *fragP, TInsn *tinsn)
|
||||
-{
|
||||
- TInsn loop_insn;
|
||||
- TInsn addi_insn;
|
||||
- TInsn addmi_insn;
|
||||
- unsigned long target;
|
||||
- static xtensa_insnbuf insnbuf = NULL;
|
||||
- unsigned int loop_length, loop_length_hi, loop_length_lo;
|
||||
- xtensa_isa isa = xtensa_default_isa;
|
||||
- addressT loop_offset;
|
||||
- addressT addi_offset = 9;
|
||||
- addressT addmi_offset = 12;
|
||||
- fragS *next_fragP;
|
||||
- int target_count;
|
||||
-
|
||||
- if (!insnbuf)
|
||||
- insnbuf = xtensa_insnbuf_alloc (isa);
|
||||
-
|
||||
- /* Get the loop offset. */
|
||||
- loop_offset = get_expanded_loop_offset (tinsn->opcode);
|
||||
-
|
||||
- /* Validate that there really is a LOOP at the loop_offset. Because
|
||||
- loops are not bundleable, we can assume that the instruction will be
|
||||
- in slot 0. */
|
||||
- tinsn_from_chars (&loop_insn, fragP->fr_opcode + loop_offset, 0);
|
||||
- tinsn_immed_from_frag (&loop_insn, fragP, 0);
|
||||
-
|
||||
- gas_assert (xtensa_opcode_is_loop (isa, loop_insn.opcode) == 1);
|
||||
- addi_offset += loop_offset;
|
||||
- addmi_offset += loop_offset;
|
||||
-
|
||||
- gas_assert (tinsn->ntok == 2);
|
||||
- if (tinsn->tok[1].X_op == O_constant)
|
||||
- target = tinsn->tok[1].X_add_number;
|
||||
- else if (tinsn->tok[1].X_op == O_symbol)
|
||||
- {
|
||||
- /* Find the fragment. */
|
||||
- symbolS *sym = tinsn->tok[1].X_add_symbol;
|
||||
- gas_assert (S_GET_SEGMENT (sym) == segP
|
||||
- || S_GET_SEGMENT (sym) == absolute_section);
|
||||
- target = (S_GET_VALUE (sym) + tinsn->tok[1].X_add_number);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- as_bad (_("invalid expression evaluation type %d"), tinsn->tok[1].X_op);
|
||||
- target = 0;
|
||||
- }
|
||||
-
|
||||
- loop_length = target - (fragP->fr_address + fragP->fr_fix);
|
||||
- loop_length_hi = loop_length & ~0x0ff;
|
||||
- loop_length_lo = loop_length & 0x0ff;
|
||||
- if (loop_length_lo >= 128)
|
||||
- {
|
||||
- loop_length_lo -= 256;
|
||||
- loop_length_hi += 256;
|
||||
- }
|
||||
-
|
||||
- /* Because addmi sign-extends the immediate, 'loop_length_hi' can be at most
|
||||
- 32512. If the loop is larger than that, then we just fail. */
|
||||
- if (loop_length_hi > 32512)
|
||||
- as_bad_where (fragP->fr_file, fragP->fr_line,
|
||||
- _("loop too long for LOOP instruction"));
|
||||
-
|
||||
- tinsn_from_chars (&addi_insn, fragP->fr_opcode + addi_offset, 0);
|
||||
- gas_assert (addi_insn.opcode == xtensa_addi_opcode);
|
||||
-
|
||||
- tinsn_from_chars (&addmi_insn, fragP->fr_opcode + addmi_offset, 0);
|
||||
- gas_assert (addmi_insn.opcode == xtensa_addmi_opcode);
|
||||
-
|
||||
- set_expr_const (&addi_insn.tok[2], loop_length_lo);
|
||||
- tinsn_to_insnbuf (&addi_insn, insnbuf);
|
||||
-
|
||||
- fragP->tc_frag_data.is_insn = TRUE;
|
||||
- xtensa_insnbuf_to_chars
|
||||
- (isa, insnbuf, (unsigned char *) fragP->fr_opcode + addi_offset, 0);
|
||||
-
|
||||
- set_expr_const (&addmi_insn.tok[2], loop_length_hi);
|
||||
- tinsn_to_insnbuf (&addmi_insn, insnbuf);
|
||||
- xtensa_insnbuf_to_chars
|
||||
- (isa, insnbuf, (unsigned char *) fragP->fr_opcode + addmi_offset, 0);
|
||||
-
|
||||
- /* Walk through all of the frags from here to the loop end
|
||||
- and mark them as no_transform to keep them from being modified
|
||||
- by the linker. If we ever have a relocation for the
|
||||
- addi/addmi of the difference of two symbols we can remove this. */
|
||||
-
|
||||
- target_count = 0;
|
||||
- for (next_fragP = fragP; next_fragP != NULL;
|
||||
- next_fragP = next_fragP->fr_next)
|
||||
- {
|
||||
- next_fragP->tc_frag_data.is_no_transform = TRUE;
|
||||
- if (next_fragP->tc_frag_data.is_loop_target)
|
||||
- target_count++;
|
||||
- if (target_count == 2)
|
||||
- break;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
|
||||
/* A map that keeps information on a per-subsegment basis. This is
|
||||
maintained during initial assembly, but is invalid once the
|
||||
diff --git a/gas/config/xtensa-relax.c b/gas/config/xtensa-relax.c
|
||||
index cb296ed85ed2..daf15d52c259 100644
|
||||
--- a/gas/config/xtensa-relax.c
|
||||
+++ b/gas/config/xtensa-relax.c
|
||||
@@ -87,13 +87,7 @@
|
||||
when the first and second operands are not the same as specified
|
||||
by the "| %at!=%as" precondition clause.
|
||||
{"l32i %at,%as,%imm | %at!=%as",
|
||||
- "LITERAL %imm; l32r %at,%LITERAL; add %at,%at,%as; l32i %at,%at,0"}
|
||||
-
|
||||
- There is special case for loop instructions here, but because we do
|
||||
- not currently have the ability to represent the difference of two
|
||||
- symbols, the conversion requires special code in the assembler to
|
||||
- write the operands of the addi/addmi pair representing the
|
||||
- difference of the old and new loop end label. */
|
||||
+ "LITERAL %imm; l32r %at,%LITERAL; add %at,%at,%as; l32i %at,%at,0"} */
|
||||
|
||||
#include "as.h"
|
||||
#include "xtensa-isa.h"
|
||||
@@ -306,44 +300,83 @@ static string_pattern_pair widen_spec_list[] =
|
||||
{"l32i %at,%as,%imm | %at!=%as ? IsaUseConst16",
|
||||
"const16 %at,HI16U(%imm); const16 %at,LOW16U(%imm); add %at,%at,%as; l32i %at,%at,0"},
|
||||
|
||||
- /* This is only PART of the loop instruction. In addition,
|
||||
- hardcoded into its use is a modification of the final operand in
|
||||
- the instruction in bytes 9 and 12. */
|
||||
- {"loop %as,%label | %as!=1 ? IsaUseLoops",
|
||||
+ /* Widening loops with literals. */
|
||||
+ {"loop %as,%label | %as!=1 ? IsaUseLoops ? IsaUseL32R",
|
||||
+ "loop %as,%LABEL;"
|
||||
+ "rsr.lend %as;" /* LEND */
|
||||
+ "wsr.lbeg %as;" /* LBEG */
|
||||
+ "LITERAL %label;"
|
||||
+ "l32r %as, %LITERAL;"
|
||||
+ "nop;"
|
||||
+ "wsr.lend %as;"
|
||||
+ "isync;"
|
||||
+ "rsr.lcount %as;" /* LCOUNT */
|
||||
+ "addi %as, %as, 1;"
|
||||
+ "LABEL"},
|
||||
+ {"loopgtz %as,%label | %as!=1 ? IsaUseLoops ? IsaUseL32R",
|
||||
+ "beqz %as,%label;"
|
||||
+ "bltz %as,%label;"
|
||||
+ "loopgtz %as,%LABEL;"
|
||||
+ "rsr.lend %as;" /* LEND */
|
||||
+ "wsr.lbeg %as;" /* LBEG */
|
||||
+ "LITERAL %label;"
|
||||
+ "l32r %as, %LITERAL;"
|
||||
+ "nop;"
|
||||
+ "wsr.lend %as;"
|
||||
+ "isync;"
|
||||
+ "rsr.lcount %as;" /* LCOUNT */
|
||||
+ "addi %as, %as, 1;"
|
||||
+ "LABEL"},
|
||||
+ {"loopnez %as,%label | %as!=1 ? IsaUseLoops ? IsaUseL32R",
|
||||
+ "beqz %as,%label;"
|
||||
+ "loopnez %as,%LABEL;"
|
||||
+ "rsr.lend %as;" /* LEND */
|
||||
+ "wsr.lbeg %as;" /* LBEG */
|
||||
+ "LITERAL %label;"
|
||||
+ "l32r %as, %LITERAL;"
|
||||
+ "nop;"
|
||||
+ "wsr.lend %as;"
|
||||
+ "isync;"
|
||||
+ "rsr.lcount %as;" /* LCOUNT */
|
||||
+ "addi %as, %as, 1;"
|
||||
+ "LABEL"},
|
||||
+
|
||||
+ /* Widening loops with const16. */
|
||||
+ {"loop %as,%label | %as!=1 ? IsaUseLoops ? IsaUseConst16",
|
||||
"loop %as,%LABEL;"
|
||||
"rsr.lend %as;" /* LEND */
|
||||
"wsr.lbeg %as;" /* LBEG */
|
||||
- "addi %as, %as, 0;" /* lo8(%label-%LABEL1) */
|
||||
- "addmi %as, %as, 0;" /* mid8(%label-%LABEL1) */
|
||||
+ "const16 %as,HI16U(%label);"
|
||||
+ "const16 %as,LOW16U(%label);"
|
||||
"wsr.lend %as;"
|
||||
"isync;"
|
||||
"rsr.lcount %as;" /* LCOUNT */
|
||||
- "addi %as, %as, 1;" /* density -> addi.n %as, %as, 1 */
|
||||
+ "addi %as, %as, 1;"
|
||||
"LABEL"},
|
||||
- {"loopgtz %as,%label | %as!=1 ? IsaUseLoops",
|
||||
+ {"loopgtz %as,%label | %as!=1 ? IsaUseLoops ? IsaUseConst16",
|
||||
"beqz %as,%label;"
|
||||
"bltz %as,%label;"
|
||||
"loopgtz %as,%LABEL;"
|
||||
"rsr.lend %as;" /* LEND */
|
||||
"wsr.lbeg %as;" /* LBEG */
|
||||
- "addi %as, %as, 0;" /* lo8(%label-%LABEL1) */
|
||||
- "addmi %as, %as, 0;" /* mid8(%label-%LABEL1) */
|
||||
+ "const16 %as,HI16U(%label);"
|
||||
+ "const16 %as,LOW16U(%label);"
|
||||
"wsr.lend %as;"
|
||||
"isync;"
|
||||
"rsr.lcount %as;" /* LCOUNT */
|
||||
- "addi %as, %as, 1;" /* density -> addi.n %as, %as, 1 */
|
||||
+ "addi %as, %as, 1;"
|
||||
"LABEL"},
|
||||
- {"loopnez %as,%label | %as!=1 ? IsaUseLoops",
|
||||
+ {"loopnez %as,%label | %as!=1 ? IsaUseLoops ? IsaUseConst16",
|
||||
"beqz %as,%label;"
|
||||
"loopnez %as,%LABEL;"
|
||||
"rsr.lend %as;" /* LEND */
|
||||
"wsr.lbeg %as;" /* LBEG */
|
||||
- "addi %as, %as, 0;" /* lo8(%label-%LABEL1) */
|
||||
- "addmi %as, %as, 0;" /* mid8(%label-%LABEL1) */
|
||||
+ "const16 %as,HI16U(%label);"
|
||||
+ "const16 %as,LOW16U(%label);"
|
||||
"wsr.lend %as;"
|
||||
"isync;"
|
||||
"rsr.lcount %as;" /* LCOUNT */
|
||||
- "addi %as, %as, 1;" /* density -> addi.n %as, %as, 1 */
|
||||
+ "addi %as, %as, 1;"
|
||||
"LABEL"},
|
||||
|
||||
/* Relaxing to wide branches. Order is important here. With wide
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
From ae435bc27e1eb59e4ad571a37a144bf99dc68f55 Mon Sep 17 00:00:00 2001
|
||||
From: Romain Naour <romain.naour@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 11:40:53 +0100
|
||||
Subject: [PATCH] ld-makefile
|
||||
|
||||
[Romain: rebase on top of 2.26]
|
||||
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
||||
---
|
||||
ld/Makefile.am | 2 +-
|
||||
ld/Makefile.in | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ld/Makefile.am b/ld/Makefile.am
|
||||
index d86ad0940c9..c95b0ef0252 100644
|
||||
--- a/ld/Makefile.am
|
||||
+++ b/ld/Makefile.am
|
||||
@@ -57,7 +57,7 @@ endif
|
||||
# We put the scripts in the directory $(scriptdir)/ldscripts.
|
||||
# We can't put the scripts in $(datadir) because the SEARCH_DIR
|
||||
# directives need to be different for native and cross linkers.
|
||||
-scriptdir = $(tooldir)/lib
|
||||
+scriptdir = $(libdir)
|
||||
|
||||
EMUL = @EMUL@
|
||||
EMULATION_OFILES = @EMULATION_OFILES@
|
||||
diff --git a/ld/Makefile.in b/ld/Makefile.in
|
||||
index 4792b2b013c..789df2d01b9 100644
|
||||
--- a/ld/Makefile.in
|
||||
+++ b/ld/Makefile.in
|
||||
@@ -563,7 +563,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
|
||||
# We put the scripts in the directory $(scriptdir)/ldscripts.
|
||||
# We can't put the scripts in $(datadir) because the SEARCH_DIR
|
||||
# directives need to be different for native and cross linkers.
|
||||
-scriptdir = $(tooldir)/lib
|
||||
+scriptdir = $(libdir)
|
||||
BASEDIR = $(srcdir)/..
|
||||
BFDDIR = $(BASEDIR)/bfd
|
||||
INCDIR = $(BASEDIR)/include
|
||||
--
|
||||
2.14.4
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
From a216bfcd91363a8e8c14db320a2870fff2985d78 Mon Sep 17 00:00:00 2001
|
||||
From: Romain Naour <romain.naour@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 11:41:47 +0100
|
||||
Subject: [PATCH] check-ldrunpath-length
|
||||
|
||||
[Romain: rebase on top of 2.26]
|
||||
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
||||
---
|
||||
ld/emultempl/elf32.em | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
|
||||
index 1ad9d6b6fa8..637a5d5d585 100644
|
||||
--- a/ld/emultempl/elf32.em
|
||||
+++ b/ld/emultempl/elf32.em
|
||||
@@ -1471,6 +1471,8 @@ fragment <<EOF
|
||||
&& command_line.rpath == NULL)
|
||||
{
|
||||
path = (const char *) getenv ("LD_RUN_PATH");
|
||||
+ if ((path) && (strlen (path) == 0))
|
||||
+ path = NULL;
|
||||
if (path
|
||||
&& gld${EMULATION_NAME}_search_needed (path, &n, force))
|
||||
break;
|
||||
@@ -1751,6 +1753,8 @@ gld${EMULATION_NAME}_before_allocation (void)
|
||||
rpath = command_line.rpath;
|
||||
if (rpath == NULL)
|
||||
rpath = (const char *) getenv ("LD_RUN_PATH");
|
||||
+ if ((rpath) && (strlen (rpath) == 0))
|
||||
+ rpath = NULL;
|
||||
|
||||
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
|
||||
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
|
||||
--
|
||||
2.14.4
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From 73ecf6f6a1f327c9fa3af1fc924d152321aac801 Mon Sep 17 00:00:00 2001
|
||||
From: Romain Naour <romain.naour@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 11:42:48 +0100
|
||||
Subject: [PATCH] add sysroot fix from bug #3049
|
||||
|
||||
Always try to prepend the sysroot prefix to absolute filenames first.
|
||||
|
||||
http://bugs.gentoo.org/275666
|
||||
http://sourceware.org/bugzilla/show_bug.cgi?id=10340
|
||||
|
||||
Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
|
||||
[Romain: rebase on top of 2.26]
|
||||
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
||||
---
|
||||
ld/ldfile.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ld/ldfile.c b/ld/ldfile.c
|
||||
index a72ff135264..b3d166cbd60 100644
|
||||
--- a/ld/ldfile.c
|
||||
+++ b/ld/ldfile.c
|
||||
@@ -338,18 +338,24 @@ ldfile_open_file_search (const char *arch,
|
||||
directory first. */
|
||||
if (!entry->flags.maybe_archive)
|
||||
{
|
||||
- if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename))
|
||||
+ /* For absolute pathnames, try to always open the file in the
|
||||
+ sysroot first. If this fails, try to open the file at the
|
||||
+ given location. */
|
||||
+ entry->flags.sysrooted = is_sysrooted_pathname (entry->filename);
|
||||
+ if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)
|
||||
+ && ld_sysroot)
|
||||
{
|
||||
char *name = concat (ld_sysroot, entry->filename,
|
||||
(const char *) NULL);
|
||||
if (ldfile_try_open_bfd (name, entry))
|
||||
{
|
||||
entry->filename = name;
|
||||
+ entry->flags.sysrooted = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
free (name);
|
||||
}
|
||||
- else if (ldfile_try_open_bfd (entry->filename, entry))
|
||||
+ if (ldfile_try_open_bfd (entry->filename, entry))
|
||||
return TRUE;
|
||||
|
||||
if (IS_ABSOLUTE_PATH (entry->filename))
|
||||
--
|
||||
2.14.4
|
||||
|
||||
@@ -0,0 +1,568 @@
|
||||
From 6737a6b34f4823deb7142f27b4074831a37ac1e1 Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Fri, 20 Jul 2018 09:18:47 -0700
|
||||
Subject: [PATCH] x86: Add a GNU_PROPERTY_X86_ISA_1_USED note if needed
|
||||
|
||||
When -z separate-code, which is enabled by default for Linux/x86, is
|
||||
used to create executable, ld won't place any data in the code-only
|
||||
PT_LOAD segment. If there are no data sections placed before the
|
||||
code-only PT_LOAD segment, the program headers won't be mapped into
|
||||
any PT_LOAD segment. When the executable tries to access it (based
|
||||
on the program header address passed in AT_PHDR), it will lead to
|
||||
segfault. This patch inserts a GNU_PROPERTY_X86_ISA_1_USED note if
|
||||
there may be no data sections before the text section so that the
|
||||
first PT_LOAD segment won't be code-only and will contain the program
|
||||
header.
|
||||
|
||||
Testcases are adjusted to either pass "-z noseparate-code" to ld or
|
||||
discard the .note.gnu.property section. A Linux/x86 run-time test is
|
||||
added.
|
||||
|
||||
bfd/
|
||||
|
||||
PR ld/23428
|
||||
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): If the
|
||||
separate code program header is needed, make sure that the first
|
||||
read-only PT_LOAD segment has no code by adding a
|
||||
GNU_PROPERTY_X86_ISA_1_USED note.
|
||||
|
||||
ld/
|
||||
|
||||
PR ld/23428
|
||||
* testsuite/ld-elf/linux-x86.S: New file.
|
||||
* testsuite/ld-elf/linux-x86.exp: Likewise.
|
||||
* testsuite/ld-elf/pr23428.c: Likewise.
|
||||
* testsuite/ld-elf/sec64k.exp: Pass "-z noseparate-code" to ld
|
||||
for Linux/x86 targets.
|
||||
* testsuite/ld-i386/abs-iamcu.d: Likewise.
|
||||
* testsuite/ld-i386/abs.d: Likewise.
|
||||
* testsuite/ld-i386/pr12718.d: Likewise.
|
||||
* testsuite/ld-i386/pr12921.d: Likewise.
|
||||
* testsuite/ld-x86-64/abs-k1om.d: Likewise.
|
||||
* testsuite/ld-x86-64/abs-l1om.d: Likewise.
|
||||
* testsuite/ld-x86-64/abs.d: Likewise.
|
||||
* testsuite/ld-x86-64/pr12718.d: Likewise.
|
||||
* testsuite/ld-x86-64/pr12921.d: Likewise.
|
||||
* testsuite/ld-linkonce/zeroeh.ld: Discard .note.gnu.property
|
||||
section.
|
||||
* testsuite/ld-scripts/print-memory-usage.t: Likewise.
|
||||
* testsuite/ld-scripts/size-2.t: Likewise.
|
||||
* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Use ld
|
||||
to create executable if language is "asm".
|
||||
|
||||
(cherry picked from commit 241e64e3b42cd9eba514b8e0ad2ef39a337f10a5)
|
||||
Signed-off-by: Norbert Lange <nolange79@gmail.com>
|
||||
---
|
||||
bfd/ChangeLog | 8 ++++
|
||||
bfd/elfxx-x86.c | 60 +++++++++++++++++++-------
|
||||
ld/ChangeLog | 24 +++++++++++
|
||||
ld/testsuite/ld-elf/linux-x86.S | 63 ++++++++++++++++++++++++++++
|
||||
ld/testsuite/ld-elf/linux-x86.exp | 46 ++++++++++++++++++++
|
||||
ld/testsuite/ld-elf/pr23428.c | 43 +++++++++++++++++++
|
||||
ld/testsuite/ld-elf/sec64k.exp | 2 +
|
||||
ld/testsuite/ld-i386/abs-iamcu.d | 2 +-
|
||||
ld/testsuite/ld-i386/abs.d | 2 +-
|
||||
ld/testsuite/ld-i386/pr12718.d | 2 +-
|
||||
ld/testsuite/ld-i386/pr12921.d | 2 +-
|
||||
ld/testsuite/ld-linkonce/zeroeh.ld | 1 +
|
||||
ld/testsuite/ld-scripts/print-memory-usage.t | 2 +
|
||||
ld/testsuite/ld-scripts/size-2.t | 1 +
|
||||
ld/testsuite/ld-x86-64/abs-k1om.d | 2 +-
|
||||
ld/testsuite/ld-x86-64/abs-l1om.d | 2 +-
|
||||
ld/testsuite/ld-x86-64/abs.d | 2 +-
|
||||
ld/testsuite/ld-x86-64/pr12718.d | 2 +-
|
||||
ld/testsuite/ld-x86-64/pr12921.d | 2 +-
|
||||
ld/testsuite/lib/ld-lib.exp | 5 ++-
|
||||
20 files changed, 248 insertions(+), 25 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-elf/linux-x86.S
|
||||
create mode 100644 ld/testsuite/ld-elf/linux-x86.exp
|
||||
create mode 100644 ld/testsuite/ld-elf/pr23428.c
|
||||
|
||||
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
|
||||
index 1c1174a..d3831b7 100644
|
||||
--- a/bfd/ChangeLog
|
||||
+++ b/bfd/ChangeLog
|
||||
@@ -1,3 +1,11 @@
|
||||
+2018-07-23 H.J. Lu <hongjiu.lu@intel.com>
|
||||
+
|
||||
+ PR ld/23428
|
||||
+ * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): If the
|
||||
+ separate code program header is needed, make sure that the first
|
||||
+ read-only PT_LOAD segment has no code by adding a
|
||||
+ GNU_PROPERTY_X86_ISA_1_USED note.
|
||||
+
|
||||
2018-07-18 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* development.sh: Set to true.
|
||||
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
|
||||
index a2497aa..2e4ff88 100644
|
||||
--- a/bfd/elfxx-x86.c
|
||||
+++ b/bfd/elfxx-x86.c
|
||||
@@ -2524,6 +2524,7 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
const struct elf_backend_data *bed;
|
||||
unsigned int class_align = ABI_64_P (info->output_bfd) ? 3 : 2;
|
||||
unsigned int got_align;
|
||||
+ bfd_boolean has_text = FALSE;
|
||||
|
||||
features = 0;
|
||||
if (info->ibt)
|
||||
@@ -2538,24 +2539,59 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
if (bfd_get_flavour (pbfd) == bfd_target_elf_flavour
|
||||
&& bfd_count_sections (pbfd) != 0)
|
||||
{
|
||||
+ if (!has_text)
|
||||
+ {
|
||||
+ /* Check if there is no non-empty text section. */
|
||||
+ sec = bfd_get_section_by_name (pbfd, ".text");
|
||||
+ if (sec != NULL && sec->size != 0)
|
||||
+ has_text = TRUE;
|
||||
+ }
|
||||
+
|
||||
ebfd = pbfd;
|
||||
|
||||
if (elf_properties (pbfd) != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
- if (ebfd != NULL && features)
|
||||
+ bed = get_elf_backend_data (info->output_bfd);
|
||||
+
|
||||
+ htab = elf_x86_hash_table (info, bed->target_id);
|
||||
+ if (htab == NULL)
|
||||
+ return pbfd;
|
||||
+
|
||||
+ if (ebfd != NULL)
|
||||
{
|
||||
- /* If features is set, add GNU_PROPERTY_X86_FEATURE_1_IBT and
|
||||
- GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
|
||||
- prop = _bfd_elf_get_property (ebfd,
|
||||
- GNU_PROPERTY_X86_FEATURE_1_AND,
|
||||
- 4);
|
||||
- prop->u.number |= features;
|
||||
- prop->pr_kind = property_number;
|
||||
+ prop = NULL;
|
||||
+ if (features)
|
||||
+ {
|
||||
+ /* If features is set, add GNU_PROPERTY_X86_FEATURE_1_IBT and
|
||||
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
|
||||
+ prop = _bfd_elf_get_property (ebfd,
|
||||
+ GNU_PROPERTY_X86_FEATURE_1_AND,
|
||||
+ 4);
|
||||
+ prop->u.number |= features;
|
||||
+ prop->pr_kind = property_number;
|
||||
+ }
|
||||
+ else if (has_text
|
||||
+ && elf_properties (ebfd) == NULL
|
||||
+ && elf_tdata (info->output_bfd)->o->build_id.sec == NULL
|
||||
+ && !htab->elf.dynamic_sections_created
|
||||
+ && !info->traditional_format
|
||||
+ && (info->output_bfd->flags & D_PAGED) != 0
|
||||
+ && info->separate_code)
|
||||
+ {
|
||||
+ /* If the separate code program header is needed, make sure
|
||||
+ that the first read-only PT_LOAD segment has no code by
|
||||
+ adding a GNU_PROPERTY_X86_ISA_1_USED note. */
|
||||
+ prop = _bfd_elf_get_property (ebfd,
|
||||
+ GNU_PROPERTY_X86_ISA_1_USED,
|
||||
+ 4);
|
||||
+ prop->u.number = GNU_PROPERTY_X86_ISA_1_486;
|
||||
+ prop->pr_kind = property_number;
|
||||
+ }
|
||||
|
||||
/* Create the GNU property note section if needed. */
|
||||
- if (pbfd == NULL)
|
||||
+ if (prop != NULL && pbfd == NULL)
|
||||
{
|
||||
sec = bfd_make_section_with_flags (ebfd,
|
||||
NOTE_GNU_PROPERTY_SECTION_NAME,
|
||||
@@ -2581,12 +2617,6 @@ error_alignment:
|
||||
|
||||
pbfd = _bfd_elf_link_setup_gnu_properties (info);
|
||||
|
||||
- bed = get_elf_backend_data (info->output_bfd);
|
||||
-
|
||||
- htab = elf_x86_hash_table (info, bed->target_id);
|
||||
- if (htab == NULL)
|
||||
- return pbfd;
|
||||
-
|
||||
htab->r_info = init_table->r_info;
|
||||
htab->r_sym = init_table->r_sym;
|
||||
|
||||
diff --git a/ld/ChangeLog b/ld/ChangeLog
|
||||
index c07e442..cfadbd4 100644
|
||||
--- a/ld/ChangeLog
|
||||
+++ b/ld/ChangeLog
|
||||
@@ -1,3 +1,27 @@
|
||||
+2018-07-23 H.J. Lu <hongjiu.lu@intel.com>
|
||||
+
|
||||
+ PR ld/23428
|
||||
+ * testsuite/ld-elf/linux-x86.S: New file.
|
||||
+ * testsuite/ld-elf/linux-x86.exp: Likewise.
|
||||
+ * testsuite/ld-elf/pr23428.c: Likewise.
|
||||
+ * testsuite/ld-elf/sec64k.exp: Pass "-z noseparate-code" to ld
|
||||
+ for Linux/x86 targets.
|
||||
+ * testsuite/ld-i386/abs-iamcu.d: Likewise.
|
||||
+ * testsuite/ld-i386/abs.d: Likewise.
|
||||
+ * testsuite/ld-i386/pr12718.d: Likewise.
|
||||
+ * testsuite/ld-i386/pr12921.d: Likewise.
|
||||
+ * testsuite/ld-x86-64/abs-k1om.d: Likewise.
|
||||
+ * testsuite/ld-x86-64/abs-l1om.d: Likewise.
|
||||
+ * testsuite/ld-x86-64/abs.d: Likewise.
|
||||
+ * testsuite/ld-x86-64/pr12718.d: Likewise.
|
||||
+ * testsuite/ld-x86-64/pr12921.d: Likewise.
|
||||
+ * testsuite/ld-linkonce/zeroeh.ld: Discard .note.gnu.property
|
||||
+ section.
|
||||
+ * testsuite/ld-scripts/print-memory-usage.t: Likewise.
|
||||
+ * testsuite/ld-scripts/size-2.t: Likewise.
|
||||
+ * testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Use ld to
|
||||
+ create executable if language is "asm".
|
||||
+
|
||||
2018-07-18 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
2.31.1 Release point.
|
||||
diff --git a/ld/testsuite/ld-elf/linux-x86.S b/ld/testsuite/ld-elf/linux-x86.S
|
||||
new file mode 100644
|
||||
index 0000000..bdf40c6
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/linux-x86.S
|
||||
@@ -0,0 +1,63 @@
|
||||
+ .text
|
||||
+ .globl _start
|
||||
+ .type _start,@function
|
||||
+ .p2align 4
|
||||
+_start:
|
||||
+ xorl %ebp, %ebp
|
||||
+#ifdef __LP64__
|
||||
+ popq %rdi
|
||||
+ movq %rsp, %rsi
|
||||
+ andq $~15, %rsp
|
||||
+#elif defined __x86_64__
|
||||
+ mov (%rsp),%edi
|
||||
+ addl $4,%esp
|
||||
+ movl %esp, %esi
|
||||
+ andl $~15, %esp
|
||||
+#else
|
||||
+ popl %esi
|
||||
+ movl %esp, %ecx
|
||||
+ andl $~15, %esp
|
||||
+
|
||||
+ subl $8,%esp
|
||||
+ pushl %ecx
|
||||
+ pushl %esi
|
||||
+#endif
|
||||
+
|
||||
+ call main
|
||||
+
|
||||
+ hlt
|
||||
+
|
||||
+ .type syscall, @function
|
||||
+ .globl syscall
|
||||
+ .p2align 4
|
||||
+syscall:
|
||||
+#ifdef __x86_64__
|
||||
+ movq %rdi, %rax /* Syscall number -> rax. */
|
||||
+ movq %rsi, %rdi /* shift arg1 - arg5. */
|
||||
+ movq %rdx, %rsi
|
||||
+ movq %rcx, %rdx
|
||||
+ movq %r8, %r10
|
||||
+ movq %r9, %r8
|
||||
+ movq 8(%rsp),%r9 /* arg6 is on the stack. */
|
||||
+ syscall /* Do the system call. */
|
||||
+#else
|
||||
+ push %ebp
|
||||
+ push %edi
|
||||
+ push %esi
|
||||
+ push %ebx
|
||||
+ mov 0x2c(%esp),%ebp
|
||||
+ mov 0x28(%esp),%edi
|
||||
+ mov 0x24(%esp),%esi
|
||||
+ mov 0x20(%esp),%edx
|
||||
+ mov 0x1c(%esp),%ecx
|
||||
+ mov 0x18(%esp),%ebx
|
||||
+ mov 0x14(%esp),%eax
|
||||
+ int $0x80
|
||||
+ pop %ebx
|
||||
+ pop %esi
|
||||
+ pop %edi
|
||||
+ pop %ebp
|
||||
+#endif
|
||||
+ ret /* Return to caller. */
|
||||
+ .size syscall, .-syscall
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp
|
||||
new file mode 100644
|
||||
index 0000000..36217c6
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/linux-x86.exp
|
||||
@@ -0,0 +1,46 @@
|
||||
+# Expect script for simple native Linux/x86 tests.
|
||||
+# Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
+#
|
||||
+# This file is part of the GNU Binutils.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 3 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
+# MA 02110-1301, USA.
|
||||
+#
|
||||
+
|
||||
+# Test very simple native Linux/x86 programs with linux-x86.S.
|
||||
+if { ![isnative] || [which $CC] == 0 \
|
||||
+ || (![istarget "i?86-*-linux*"] \
|
||||
+ && ![istarget "x86_64-*-linux*"] \
|
||||
+ && ![istarget "amd64-*-linux*"]) } {
|
||||
+ return
|
||||
+}
|
||||
+
|
||||
+# Add $PLT_CFLAGS if PLT is expected.
|
||||
+global PLT_CFLAGS
|
||||
+# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
|
||||
+global NOPIE_CFLAGS NOPIE_LDFLAGS
|
||||
+
|
||||
+run_ld_link_exec_tests [list \
|
||||
+ [list \
|
||||
+ "Run PR ld/23428 test" \
|
||||
+ "--no-dynamic-linker -z separate-code" \
|
||||
+ "" \
|
||||
+ { linux-x86.S pr23428.c } \
|
||||
+ "pr23428" \
|
||||
+ "pass.out" \
|
||||
+ "$NOPIE_CFLAGS -fno-asynchronous-unwind-tables" \
|
||||
+ "asm" \
|
||||
+ ] \
|
||||
+]
|
||||
diff --git a/ld/testsuite/ld-elf/pr23428.c b/ld/testsuite/ld-elf/pr23428.c
|
||||
new file mode 100644
|
||||
index 0000000..3631ed7
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/pr23428.c
|
||||
@@ -0,0 +1,43 @@
|
||||
+#include <unistd.h>
|
||||
+#include <link.h>
|
||||
+#include <syscall.h>
|
||||
+
|
||||
+#define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1)
|
||||
+
|
||||
+int
|
||||
+main (int argc, char **argv)
|
||||
+{
|
||||
+ char **ev = &argv[argc + 1];
|
||||
+ char **evp = ev;
|
||||
+ ElfW(auxv_t) *av;
|
||||
+ const ElfW(Phdr) *phdr = NULL;
|
||||
+ size_t phnum = 0;
|
||||
+ size_t loadnum = 0;
|
||||
+ int fd = STDOUT_FILENO;
|
||||
+ size_t i;
|
||||
+
|
||||
+ while (*evp++ != NULL)
|
||||
+ ;
|
||||
+
|
||||
+ av = (ElfW(auxv_t) *) evp;
|
||||
+
|
||||
+ for (; av->a_type != AT_NULL; ++av)
|
||||
+ switch (av->a_type)
|
||||
+ {
|
||||
+ case AT_PHDR:
|
||||
+ phdr = (const void *) av->a_un.a_val;
|
||||
+ break;
|
||||
+ case AT_PHNUM:
|
||||
+ phnum = av->a_un.a_val;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < phnum; i++, phdr++)
|
||||
+ if (phdr->p_type == PT_LOAD)
|
||||
+ loadnum++;
|
||||
+
|
||||
+ syscall (SYS_write, fd, STRING_COMMA_LEN ("PASS\n"));
|
||||
+
|
||||
+ syscall (SYS_exit, !loadnum);
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/ld/testsuite/ld-elf/sec64k.exp b/ld/testsuite/ld-elf/sec64k.exp
|
||||
index b58139e..3909c0e 100644
|
||||
--- a/ld/testsuite/ld-elf/sec64k.exp
|
||||
+++ b/ld/testsuite/ld-elf/sec64k.exp
|
||||
@@ -177,6 +177,8 @@ if { ![istarget "d10v-*-*"]
|
||||
foreach sfile $sfiles { puts $ofd "#source: $sfile" }
|
||||
if { [istarget spu*-*-*] } {
|
||||
puts $ofd "#ld: --local-store 0:0"
|
||||
+ } elseif { [istarget "i?86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
|
||||
+ puts $ofd "#ld: -z noseparate-code"
|
||||
} else {
|
||||
puts $ofd "#ld:"
|
||||
}
|
||||
diff --git a/ld/testsuite/ld-i386/abs-iamcu.d b/ld/testsuite/ld-i386/abs-iamcu.d
|
||||
index ac9beff..aba7d6b 100644
|
||||
--- a/ld/testsuite/ld-i386/abs-iamcu.d
|
||||
+++ b/ld/testsuite/ld-i386/abs-iamcu.d
|
||||
@@ -2,7 +2,7 @@
|
||||
#source: abs.s
|
||||
#source: zero.s
|
||||
#as: --32 -march=iamcu
|
||||
-#ld: -m elf_iamcu
|
||||
+#ld: -m elf_iamcu -z noseparate-code
|
||||
#objdump: -rs -j .text
|
||||
|
||||
.*: file format .*
|
||||
diff --git a/ld/testsuite/ld-i386/abs.d b/ld/testsuite/ld-i386/abs.d
|
||||
index e660aca..191ee44 100644
|
||||
--- a/ld/testsuite/ld-i386/abs.d
|
||||
+++ b/ld/testsuite/ld-i386/abs.d
|
||||
@@ -2,7 +2,7 @@
|
||||
#as: --32
|
||||
#source: abs.s
|
||||
#source: zero.s
|
||||
-#ld: -melf_i386
|
||||
+#ld: -melf_i386 -z noseparate-code
|
||||
#objdump: -rs
|
||||
|
||||
.*: file format .*
|
||||
diff --git a/ld/testsuite/ld-i386/pr12718.d b/ld/testsuite/ld-i386/pr12718.d
|
||||
index ec51540..7eba52d 100644
|
||||
--- a/ld/testsuite/ld-i386/pr12718.d
|
||||
+++ b/ld/testsuite/ld-i386/pr12718.d
|
||||
@@ -1,6 +1,6 @@
|
||||
#name: PR ld/12718
|
||||
#as: --32
|
||||
-#ld: -melf_i386
|
||||
+#ld: -melf_i386 -z noseparate-code
|
||||
#readelf: -S
|
||||
|
||||
There are 5 section headers, starting at offset 0x[0-9a-f]+:
|
||||
diff --git a/ld/testsuite/ld-i386/pr12921.d b/ld/testsuite/ld-i386/pr12921.d
|
||||
index e49079b..ea2da3e 100644
|
||||
--- a/ld/testsuite/ld-i386/pr12921.d
|
||||
+++ b/ld/testsuite/ld-i386/pr12921.d
|
||||
@@ -1,6 +1,6 @@
|
||||
#name: PR ld/12921
|
||||
#as: --32
|
||||
-#ld: -melf_i386
|
||||
+#ld: -melf_i386 -z noseparate-code
|
||||
#readelf: -S --wide
|
||||
|
||||
There are 7 section headers, starting at offset 0x[0-9a-f]+:
|
||||
diff --git a/ld/testsuite/ld-linkonce/zeroeh.ld b/ld/testsuite/ld-linkonce/zeroeh.ld
|
||||
index b22eaa1..f89855a 100644
|
||||
--- a/ld/testsuite/ld-linkonce/zeroeh.ld
|
||||
+++ b/ld/testsuite/ld-linkonce/zeroeh.ld
|
||||
@@ -2,4 +2,5 @@ SECTIONS {
|
||||
.text 0xa00 : { *(.text); *(.gnu.linkonce.t.*) }
|
||||
.gcc_except_table 0x2000 : { *(.gcc_except_table) }
|
||||
.eh_frame 0x4000 : { *(.eh_frame) }
|
||||
+ /DISCARD/ : { *(.note.gnu.property) }
|
||||
}
|
||||
diff --git a/ld/testsuite/ld-scripts/print-memory-usage.t b/ld/testsuite/ld-scripts/print-memory-usage.t
|
||||
index 5ff057a..6eda1d2 100644
|
||||
--- a/ld/testsuite/ld-scripts/print-memory-usage.t
|
||||
+++ b/ld/testsuite/ld-scripts/print-memory-usage.t
|
||||
@@ -11,4 +11,6 @@ SECTIONS
|
||||
*(.data)
|
||||
*(.rw)
|
||||
}
|
||||
+
|
||||
+ /DISCARD/ : { *(.note.gnu.property) }
|
||||
}
|
||||
diff --git a/ld/testsuite/ld-scripts/size-2.t b/ld/testsuite/ld-scripts/size-2.t
|
||||
index 7238639..c3c4edd 100644
|
||||
--- a/ld/testsuite/ld-scripts/size-2.t
|
||||
+++ b/ld/testsuite/ld-scripts/size-2.t
|
||||
@@ -18,4 +18,5 @@ SECTIONS
|
||||
LONG (SIZEOF (.tdata))
|
||||
LONG (SIZEOF (.tbss))
|
||||
} :image
|
||||
+ /DISCARD/ : { *(.note.gnu.property) }
|
||||
}
|
||||
diff --git a/ld/testsuite/ld-x86-64/abs-k1om.d b/ld/testsuite/ld-x86-64/abs-k1om.d
|
||||
index 2c26639..6b0fde0 100644
|
||||
--- a/ld/testsuite/ld-x86-64/abs-k1om.d
|
||||
+++ b/ld/testsuite/ld-x86-64/abs-k1om.d
|
||||
@@ -2,7 +2,7 @@
|
||||
#source: ../ld-i386/abs.s
|
||||
#source: ../ld-i386/zero.s
|
||||
#as: --64 -march=k1om
|
||||
-#ld: -m elf_k1om
|
||||
+#ld: -m elf_k1om -z noseparate-code
|
||||
#objdump: -rs -j .text
|
||||
|
||||
.*: file format .*
|
||||
diff --git a/ld/testsuite/ld-x86-64/abs-l1om.d b/ld/testsuite/ld-x86-64/abs-l1om.d
|
||||
index 1fb96d4..f87869f 100644
|
||||
--- a/ld/testsuite/ld-x86-64/abs-l1om.d
|
||||
+++ b/ld/testsuite/ld-x86-64/abs-l1om.d
|
||||
@@ -2,7 +2,7 @@
|
||||
#source: ../ld-i386/abs.s
|
||||
#source: ../ld-i386/zero.s
|
||||
#as: --64 -march=l1om
|
||||
-#ld: -m elf_l1om
|
||||
+#ld: -m elf_l1om -z noseparate-code
|
||||
#objdump: -rs -j .text
|
||||
#target: x86_64-*-linux*
|
||||
|
||||
diff --git a/ld/testsuite/ld-x86-64/abs.d b/ld/testsuite/ld-x86-64/abs.d
|
||||
index b24b018..d99ab46 100644
|
||||
--- a/ld/testsuite/ld-x86-64/abs.d
|
||||
+++ b/ld/testsuite/ld-x86-64/abs.d
|
||||
@@ -1,7 +1,7 @@
|
||||
#name: Absolute non-overflowing relocs
|
||||
#source: ../ld-i386/abs.s
|
||||
#source: ../ld-i386/zero.s
|
||||
-#ld:
|
||||
+#ld: -z noseparate-code
|
||||
#objdump: -rs
|
||||
|
||||
.*: file format .*
|
||||
diff --git a/ld/testsuite/ld-x86-64/pr12718.d b/ld/testsuite/ld-x86-64/pr12718.d
|
||||
index 07d1732..2c503ff 100644
|
||||
--- a/ld/testsuite/ld-x86-64/pr12718.d
|
||||
+++ b/ld/testsuite/ld-x86-64/pr12718.d
|
||||
@@ -1,6 +1,6 @@
|
||||
#name: PR ld/12718
|
||||
#as: --64
|
||||
-#ld: -melf_x86_64
|
||||
+#ld: -melf_x86_64 -z noseparate-code
|
||||
#readelf: -S --wide
|
||||
|
||||
There are 5 section headers, starting at offset 0x[0-9a-f]+:
|
||||
diff --git a/ld/testsuite/ld-x86-64/pr12921.d b/ld/testsuite/ld-x86-64/pr12921.d
|
||||
index 6fe6abe..1162d55 100644
|
||||
--- a/ld/testsuite/ld-x86-64/pr12921.d
|
||||
+++ b/ld/testsuite/ld-x86-64/pr12921.d
|
||||
@@ -1,6 +1,6 @@
|
||||
#name: PR ld/12921
|
||||
#as: --64
|
||||
-#ld: -melf_x86_64
|
||||
+#ld: -melf_x86_64 -z noseparate-code
|
||||
#readelf: -S --wide
|
||||
|
||||
There are 7 section headers, starting at offset 0x[0-9a-f]+:
|
||||
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
|
||||
index cfbefe9..1095091 100644
|
||||
--- a/ld/testsuite/lib/ld-lib.exp
|
||||
+++ b/ld/testsuite/lib/ld-lib.exp
|
||||
@@ -1482,7 +1482,10 @@ proc run_ld_link_exec_tests { ldtests args } {
|
||||
continue
|
||||
}
|
||||
|
||||
- if { [ string match "c++" $lang ] } {
|
||||
+ if { [ string match "asm" $lang ] } {
|
||||
+ set link_proc ld_link
|
||||
+ set link_cmd $ld
|
||||
+ } elseif { [ string match "c++" $lang ] } {
|
||||
set link_proc ld_link
|
||||
set link_cmd $CXX
|
||||
} else {
|
||||
--
|
||||
2.9.3
|
||||
|
||||
@@ -0,0 +1,588 @@
|
||||
From d55c3e36094f06bb1fb02f5eac19fdccf1d91f7e Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Wed, 8 Aug 2018 06:09:15 -0700
|
||||
Subject: [PATCH] x86: Properly merge GNU_PROPERTY_X86_ISA_1_USED
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=utf8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Without the GNU_PROPERTY_X86_ISA_1_USED property, all ISAs may be used.
|
||||
If a bit in the GNU_PROPERTY_X86_ISA_1_USED property is unset, the
|
||||
corresponding x86 instruction set isnât used. When merging properties
|
||||
from 2 input files and one input file doesn't have the
|
||||
GNU_PROPERTY_X86_ISA_1_USED property, the output file shouldn't have
|
||||
it neither. This patch removes the GNU_PROPERTY_X86_ISA_1_USED
|
||||
property if an input file doesn't have it.
|
||||
|
||||
This patch replaces the GNU_PROPERTY_X86_ISA_1_USED property with the
|
||||
GNU_PROPERTY_X86_ISA_1_NEEDED property which is the minimum ISA
|
||||
requirement.
|
||||
|
||||
bfd/
|
||||
|
||||
PR ld/23486
|
||||
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove
|
||||
GNU_PROPERTY_X86_ISA_1_USED if an input file doesn't have it.
|
||||
(_bfd_x86_elf_link_setup_gnu_properties): Adding the
|
||||
GNU_PROPERTY_X86_ISA_1_NEEDED, instead of
|
||||
GNU_PROPERTY_X86_ISA_1_USED, property.
|
||||
|
||||
ld/
|
||||
|
||||
PR ld/23486
|
||||
* testsuite/ld-i386/i386.exp: Run PR ld/23486 tests.
|
||||
* testsuite/ld-x86-64/x86-64.exp: Likewise.
|
||||
* testsuite/ld-i386/pr23486a.d: New file.
|
||||
* testsuite/ld-i386/pr23486b.d: Likewise.
|
||||
* testsuite/ld-x86-64/pr23486a-x32.d: Likewise.
|
||||
* testsuite/ld-x86-64/pr23486a.d: Likewise.
|
||||
* testsuite/ld-x86-64/pr23486a.s: Likewise.
|
||||
* testsuite/ld-x86-64/pr23486b-x32.d: Likewise.
|
||||
* testsuite/ld-x86-64/pr23486b.d: Likewise.
|
||||
* testsuite/ld-x86-64/pr23486b.s: Likewise.
|
||||
* testsuite/ld-i386/property-3.r: Remove "x86 ISA used".
|
||||
* testsuite/ld-i386/property-4.r: Likewise.
|
||||
* testsuite/ld-i386/property-5.r: Likewise.
|
||||
* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
|
||||
* testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
|
||||
* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
|
||||
* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
|
||||
* testsuite/ld-x86-64/property-3.r: Likewise.
|
||||
* testsuite/ld-x86-64/property-4.r: Likewise.
|
||||
* testsuite/ld-x86-64/property-5.r: Likewise.
|
||||
* testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
|
||||
* testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
|
||||
* testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
|
||||
* testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
|
||||
* testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
|
||||
* testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
|
||||
* testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
|
||||
* testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.
|
||||
|
||||
(cherry picked from commit f7309df20c4e787041cedc4a6aced89c15259e54)
|
||||
Signed-off-by: Norbert Lange <nolange79@gmail.com>
|
||||
---
|
||||
bfd/ChangeLog | 9 +++++++
|
||||
bfd/elfxx-x86.c | 25 ++++++++++++++----
|
||||
ld/ChangeLog | 32 +++++++++++++++++++++++
|
||||
ld/testsuite/ld-i386/i386.exp | 2 ++
|
||||
ld/testsuite/ld-i386/pr23486a.d | 10 +++++++
|
||||
ld/testsuite/ld-i386/pr23486b.d | 10 +++++++
|
||||
ld/testsuite/ld-i386/property-3.r | 1 -
|
||||
ld/testsuite/ld-i386/property-4.r | 1 -
|
||||
ld/testsuite/ld-i386/property-5.r | 1 -
|
||||
ld/testsuite/ld-i386/property-x86-ibt3a.d | 5 ++--
|
||||
ld/testsuite/ld-i386/property-x86-ibt3b.d | 5 ++--
|
||||
ld/testsuite/ld-i386/property-x86-shstk3a.d | 5 ++--
|
||||
ld/testsuite/ld-i386/property-x86-shstk3b.d | 5 ++--
|
||||
ld/testsuite/ld-x86-64/pr23486a-x32.d | 10 +++++++
|
||||
ld/testsuite/ld-x86-64/pr23486a.d | 10 +++++++
|
||||
ld/testsuite/ld-x86-64/pr23486a.s | 30 +++++++++++++++++++++
|
||||
ld/testsuite/ld-x86-64/pr23486b-x32.d | 10 +++++++
|
||||
ld/testsuite/ld-x86-64/pr23486b.d | 10 +++++++
|
||||
ld/testsuite/ld-x86-64/pr23486b.s | 30 +++++++++++++++++++++
|
||||
ld/testsuite/ld-x86-64/property-3.r | 1 -
|
||||
ld/testsuite/ld-x86-64/property-4.r | 1 -
|
||||
ld/testsuite/ld-x86-64/property-5.r | 1 -
|
||||
ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d | 5 ++--
|
||||
ld/testsuite/ld-x86-64/property-x86-ibt3a.d | 5 ++--
|
||||
ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d | 5 ++--
|
||||
ld/testsuite/ld-x86-64/property-x86-ibt3b.d | 5 ++--
|
||||
ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d | 5 ++--
|
||||
ld/testsuite/ld-x86-64/property-x86-shstk3a.d | 5 ++--
|
||||
ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d | 5 ++--
|
||||
ld/testsuite/ld-x86-64/property-x86-shstk3b.d | 5 ++--
|
||||
ld/testsuite/ld-x86-64/x86-64.exp | 4 +++
|
||||
31 files changed, 211 insertions(+), 47 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-i386/pr23486a.d
|
||||
create mode 100644 ld/testsuite/ld-i386/pr23486b.d
|
||||
create mode 100644 ld/testsuite/ld-x86-64/pr23486a-x32.d
|
||||
create mode 100644 ld/testsuite/ld-x86-64/pr23486a.d
|
||||
create mode 100644 ld/testsuite/ld-x86-64/pr23486a.s
|
||||
create mode 100644 ld/testsuite/ld-x86-64/pr23486b-x32.d
|
||||
create mode 100644 ld/testsuite/ld-x86-64/pr23486b.d
|
||||
create mode 100644 ld/testsuite/ld-x86-64/pr23486b.s
|
||||
|
||||
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
|
||||
index 2e4ff88..7ccfd25 100644
|
||||
--- a/bfd/elfxx-x86.c
|
||||
+++ b/bfd/elfxx-x86.c
|
||||
@@ -2407,12 +2407,27 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info,
|
||||
switch (pr_type)
|
||||
{
|
||||
case GNU_PROPERTY_X86_ISA_1_USED:
|
||||
+ if (aprop == NULL || bprop == NULL)
|
||||
+ {
|
||||
+ /* Only one of APROP and BPROP can be NULL. */
|
||||
+ if (aprop != NULL)
|
||||
+ {
|
||||
+ /* Remove this property since the other input file doesn't
|
||||
+ have it. */
|
||||
+ aprop->pr_kind = property_remove;
|
||||
+ updated = TRUE;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+ goto or_property;
|
||||
+
|
||||
case GNU_PROPERTY_X86_ISA_1_NEEDED:
|
||||
if (aprop != NULL && bprop != NULL)
|
||||
{
|
||||
+or_property:
|
||||
number = aprop->u.number;
|
||||
aprop->u.number = number | bprop->u.number;
|
||||
- /* Remove the property if ISA bits are empty. */
|
||||
+ /* Remove the property if all bits are empty. */
|
||||
if (aprop->u.number == 0)
|
||||
{
|
||||
aprop->pr_kind = property_remove;
|
||||
@@ -2428,14 +2443,14 @@ _bfd_x86_elf_merge_gnu_properties (struct bfd_link_info *info,
|
||||
{
|
||||
if (aprop->u.number == 0)
|
||||
{
|
||||
- /* Remove APROP if ISA bits are empty. */
|
||||
+ /* Remove APROP if all bits are empty. */
|
||||
aprop->pr_kind = property_remove;
|
||||
updated = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
- /* Return TRUE if APROP is NULL and ISA bits of BPROP
|
||||
+ /* Return TRUE if APROP is NULL and all bits of BPROP
|
||||
aren't empty to indicate that BPROP should be added
|
||||
to ABFD. */
|
||||
updated = bprop->u.number != 0;
|
||||
@@ -2582,9 +2597,9 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
{
|
||||
/* If the separate code program header is needed, make sure
|
||||
that the first read-only PT_LOAD segment has no code by
|
||||
- adding a GNU_PROPERTY_X86_ISA_1_USED note. */
|
||||
+ adding a GNU_PROPERTY_X86_ISA_1_NEEDED note. */
|
||||
prop = _bfd_elf_get_property (ebfd,
|
||||
- GNU_PROPERTY_X86_ISA_1_USED,
|
||||
+ GNU_PROPERTY_X86_ISA_1_NEEDED,
|
||||
4);
|
||||
prop->u.number = GNU_PROPERTY_X86_ISA_1_486;
|
||||
prop->pr_kind = property_number;
|
||||
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
|
||||
index 6d794fe..78dad02 100644
|
||||
--- a/ld/testsuite/ld-i386/i386.exp
|
||||
+++ b/ld/testsuite/ld-i386/i386.exp
|
||||
@@ -462,6 +462,8 @@ run_dump_test "pr23189"
|
||||
run_dump_test "pr23194"
|
||||
run_dump_test "pr23372a"
|
||||
run_dump_test "pr23372b"
|
||||
+run_dump_test "pr23486a"
|
||||
+run_dump_test "pr23486b"
|
||||
|
||||
if { !([istarget "i?86-*-linux*"]
|
||||
|| [istarget "i?86-*-gnu*"]
|
||||
diff --git a/ld/testsuite/ld-i386/pr23486a.d b/ld/testsuite/ld-i386/pr23486a.d
|
||||
new file mode 100644
|
||||
index 0000000..41a6dcf
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-i386/pr23486a.d
|
||||
@@ -0,0 +1,10 @@
|
||||
+#source: ../ld-x86-64/pr23486a.s
|
||||
+#source: ../ld-x86-64/pr23486b.s
|
||||
+#as: --32
|
||||
+#ld: -r -m elf_i386
|
||||
+#readelf: -n
|
||||
+
|
||||
+Displaying notes found in: .note.gnu.property
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586
|
||||
diff --git a/ld/testsuite/ld-i386/pr23486b.d b/ld/testsuite/ld-i386/pr23486b.d
|
||||
new file mode 100644
|
||||
index 0000000..08019b7
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-i386/pr23486b.d
|
||||
@@ -0,0 +1,10 @@
|
||||
+#source: ../ld-x86-64/pr23486b.s
|
||||
+#source: ../ld-x86-64/pr23486a.s
|
||||
+#as: --32
|
||||
+#ld: -r -m elf_i386
|
||||
+#readelf: -n
|
||||
+
|
||||
+Displaying notes found in: .note.gnu.property
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586
|
||||
diff --git a/ld/testsuite/ld-i386/property-3.r b/ld/testsuite/ld-i386/property-3.r
|
||||
index 0ed91f5..d03203c 100644
|
||||
--- a/ld/testsuite/ld-i386/property-3.r
|
||||
+++ b/ld/testsuite/ld-i386/property-3.r
|
||||
@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
|
||||
Properties: stack size: 0x800000
|
||||
- x86 ISA used: 586, SSE
|
||||
x86 ISA needed: i486, 586
|
||||
#pass
|
||||
diff --git a/ld/testsuite/ld-i386/property-4.r b/ld/testsuite/ld-i386/property-4.r
|
||||
index cb2bc15..da295eb 100644
|
||||
--- a/ld/testsuite/ld-i386/property-4.r
|
||||
+++ b/ld/testsuite/ld-i386/property-4.r
|
||||
@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
|
||||
Properties: stack size: 0x800000
|
||||
- x86 ISA used: i486, 586, SSE
|
||||
x86 ISA needed: i486, 586, SSE
|
||||
#pass
|
||||
diff --git a/ld/testsuite/ld-i386/property-5.r b/ld/testsuite/ld-i386/property-5.r
|
||||
index 5529650..e414159 100644
|
||||
--- a/ld/testsuite/ld-i386/property-5.r
|
||||
+++ b/ld/testsuite/ld-i386/property-5.r
|
||||
@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
|
||||
Properties: stack size: 0x900000
|
||||
- x86 ISA used: i486, 586, SSE
|
||||
x86 ISA needed: i486, 586, SSE
|
||||
#pass
|
||||
diff --git a/ld/testsuite/ld-i386/property-x86-ibt3a.d b/ld/testsuite/ld-i386/property-x86-ibt3a.d
|
||||
index 4bb35b0..0aedea1 100644
|
||||
--- a/ld/testsuite/ld-i386/property-x86-ibt3a.d
|
||||
+++ b/ld/testsuite/ld-i386/property-x86-ibt3a.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: i486, 586, SSE2, SSE3
|
||||
- x86 ISA needed: 586, SSE, SSE3, SSE4_1
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: 586, SSE, SSE3, SSE4_1
|
||||
diff --git a/ld/testsuite/ld-i386/property-x86-ibt3b.d b/ld/testsuite/ld-i386/property-x86-ibt3b.d
|
||||
index 418d58a..bd69ac6 100644
|
||||
--- a/ld/testsuite/ld-i386/property-x86-ibt3b.d
|
||||
+++ b/ld/testsuite/ld-i386/property-x86-ibt3b.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: i486, 586, SSE2, SSE3
|
||||
- x86 ISA needed: 586, SSE, SSE3, SSE4_1
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: 586, SSE, SSE3, SSE4_1
|
||||
diff --git a/ld/testsuite/ld-i386/property-x86-shstk3a.d b/ld/testsuite/ld-i386/property-x86-shstk3a.d
|
||||
index e261038..76d2a39 100644
|
||||
--- a/ld/testsuite/ld-i386/property-x86-shstk3a.d
|
||||
+++ b/ld/testsuite/ld-i386/property-x86-shstk3a.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: i486, 586, SSE2, SSE3
|
||||
- x86 ISA needed: 586, SSE, SSE3, SSE4_1
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: 586, SSE, SSE3, SSE4_1
|
||||
diff --git a/ld/testsuite/ld-i386/property-x86-shstk3b.d b/ld/testsuite/ld-i386/property-x86-shstk3b.d
|
||||
index 25f3d23..e770ecf 100644
|
||||
--- a/ld/testsuite/ld-i386/property-x86-shstk3b.d
|
||||
+++ b/ld/testsuite/ld-i386/property-x86-shstk3b.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: i486, 586, SSE2, SSE3
|
||||
- x86 ISA needed: 586, SSE, SSE3, SSE4_1
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: 586, SSE, SSE3, SSE4_1
|
||||
diff --git a/ld/testsuite/ld-x86-64/pr23486a-x32.d b/ld/testsuite/ld-x86-64/pr23486a-x32.d
|
||||
new file mode 100644
|
||||
index 0000000..6d9fa68
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-x86-64/pr23486a-x32.d
|
||||
@@ -0,0 +1,10 @@
|
||||
+#source: pr23486a.s
|
||||
+#source: pr23486b.s
|
||||
+#as: --x32
|
||||
+#ld: -r -m elf32_x86_64
|
||||
+#readelf: -n
|
||||
+
|
||||
+Displaying notes found in: .note.gnu.property
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586
|
||||
diff --git a/ld/testsuite/ld-x86-64/pr23486a.d b/ld/testsuite/ld-x86-64/pr23486a.d
|
||||
new file mode 100644
|
||||
index 0000000..dc2b7bf
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-x86-64/pr23486a.d
|
||||
@@ -0,0 +1,10 @@
|
||||
+#source: pr23486a.s
|
||||
+#source: pr23486b.s
|
||||
+#as: --64 -defsym __64_bit__=1
|
||||
+#ld: -r -m elf_x86_64
|
||||
+#readelf: -n
|
||||
+
|
||||
+Displaying notes found in: .note.gnu.property
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586
|
||||
diff --git a/ld/testsuite/ld-x86-64/pr23486a.s b/ld/testsuite/ld-x86-64/pr23486a.s
|
||||
new file mode 100644
|
||||
index 0000000..a07d0c7
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-x86-64/pr23486a.s
|
||||
@@ -0,0 +1,30 @@
|
||||
+ .section ".note.gnu.property", "a"
|
||||
+.ifdef __64_bit__
|
||||
+ .p2align 3
|
||||
+.else
|
||||
+ .p2align 2
|
||||
+.endif
|
||||
+ .long 1f - 0f /* name length. */
|
||||
+ .long 4f - 1f /* data length. */
|
||||
+ /* NT_GNU_PROPERTY_TYPE_0 */
|
||||
+ .long 5 /* note type. */
|
||||
+0:
|
||||
+ .asciz "GNU" /* vendor name. */
|
||||
+1:
|
||||
+.ifdef __64_bit__
|
||||
+ .p2align 3
|
||||
+.else
|
||||
+ .p2align 2
|
||||
+.endif
|
||||
+ /* GNU_PROPERTY_X86_ISA_1_USED */
|
||||
+ .long 0xc0000000 /* pr_type. */
|
||||
+ .long 3f - 2f /* pr_datasz. */
|
||||
+2:
|
||||
+ .long 0xa
|
||||
+3:
|
||||
+.ifdef __64_bit__
|
||||
+ .p2align 3
|
||||
+.else
|
||||
+ .p2align 2
|
||||
+.endif
|
||||
+4:
|
||||
diff --git a/ld/testsuite/ld-x86-64/pr23486b-x32.d b/ld/testsuite/ld-x86-64/pr23486b-x32.d
|
||||
new file mode 100644
|
||||
index 0000000..0445e69
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-x86-64/pr23486b-x32.d
|
||||
@@ -0,0 +1,10 @@
|
||||
+#source: pr23486b.s
|
||||
+#source: pr23486a.s
|
||||
+#as: --x32
|
||||
+#ld: -r -m elf32_x86_64
|
||||
+#readelf: -n
|
||||
+
|
||||
+Displaying notes found in: .note.gnu.property
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586
|
||||
diff --git a/ld/testsuite/ld-x86-64/pr23486b.d b/ld/testsuite/ld-x86-64/pr23486b.d
|
||||
new file mode 100644
|
||||
index 0000000..dc2b7bf
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-x86-64/pr23486b.d
|
||||
@@ -0,0 +1,10 @@
|
||||
+#source: pr23486a.s
|
||||
+#source: pr23486b.s
|
||||
+#as: --64 -defsym __64_bit__=1
|
||||
+#ld: -r -m elf_x86_64
|
||||
+#readelf: -n
|
||||
+
|
||||
+Displaying notes found in: .note.gnu.property
|
||||
+ Owner Data size Description
|
||||
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586
|
||||
diff --git a/ld/testsuite/ld-x86-64/pr23486b.s b/ld/testsuite/ld-x86-64/pr23486b.s
|
||||
new file mode 100644
|
||||
index 0000000..c5167ee
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-x86-64/pr23486b.s
|
||||
@@ -0,0 +1,30 @@
|
||||
+ .section ".note.gnu.property", "a"
|
||||
+.ifdef __64_bit__
|
||||
+ .p2align 3
|
||||
+.else
|
||||
+ .p2align 2
|
||||
+.endif
|
||||
+ .long 1f - 0f /* name length. */
|
||||
+ .long 4f - 1f /* data length. */
|
||||
+ /* NT_GNU_PROPERTY_TYPE_0 */
|
||||
+ .long 5 /* note type. */
|
||||
+0:
|
||||
+ .asciz "GNU" /* vendor name. */
|
||||
+1:
|
||||
+.ifdef __64_bit__
|
||||
+ .p2align 3
|
||||
+.else
|
||||
+ .p2align 2
|
||||
+.endif
|
||||
+ /* GNU_PROPERTY_X86_ISA_1_NEEDED */
|
||||
+ .long 0xc0000001 /* pr_type. */
|
||||
+ .long 3f - 2f /* pr_datasz. */
|
||||
+2:
|
||||
+ .long 0x3
|
||||
+3:
|
||||
+.ifdef __64_bit__
|
||||
+ .p2align 3
|
||||
+.else
|
||||
+ .p2align 2
|
||||
+.endif
|
||||
+4:
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-3.r b/ld/testsuite/ld-x86-64/property-3.r
|
||||
index 0ed91f5..d03203c 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-3.r
|
||||
+++ b/ld/testsuite/ld-x86-64/property-3.r
|
||||
@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
|
||||
Properties: stack size: 0x800000
|
||||
- x86 ISA used: 586, SSE
|
||||
x86 ISA needed: i486, 586
|
||||
#pass
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-4.r b/ld/testsuite/ld-x86-64/property-4.r
|
||||
index cb2bc15..da295eb 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-4.r
|
||||
+++ b/ld/testsuite/ld-x86-64/property-4.r
|
||||
@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
|
||||
Properties: stack size: 0x800000
|
||||
- x86 ISA used: i486, 586, SSE
|
||||
x86 ISA needed: i486, 586, SSE
|
||||
#pass
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-5.r b/ld/testsuite/ld-x86-64/property-5.r
|
||||
index 5529650..e414159 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-5.r
|
||||
+++ b/ld/testsuite/ld-x86-64/property-5.r
|
||||
@@ -3,6 +3,5 @@ Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
GNU 0x[0-9a-f]+ NT_GNU_PROPERTY_TYPE_0
|
||||
Properties: stack size: 0x900000
|
||||
- x86 ISA used: i486, 586, SSE
|
||||
x86 ISA needed: i486, 586, SSE
|
||||
#pass
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d
|
||||
index 011426f..4cec728 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d
|
||||
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
|
||||
- x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3a.d b/ld/testsuite/ld-x86-64/property-x86-ibt3a.d
|
||||
index 1b4229a..a8df49a 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-x86-ibt3a.d
|
||||
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt3a.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
|
||||
- x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d
|
||||
index 290ed6a..c112626 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d
|
||||
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
|
||||
- x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3b.d b/ld/testsuite/ld-x86-64/property-x86-ibt3b.d
|
||||
index 1142e03..f10dffd 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-x86-ibt3b.d
|
||||
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt3b.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
|
||||
- x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d
|
||||
index 819542d..0147a3c 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d
|
||||
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
|
||||
- x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3a.d b/ld/testsuite/ld-x86-64/property-x86-shstk3a.d
|
||||
index 4c5d0e0..1f8c2dc 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-x86-shstk3a.d
|
||||
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk3a.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
|
||||
- x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d
|
||||
index ba181e0..7ca2539 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d
|
||||
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
|
||||
- x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3b.d b/ld/testsuite/ld-x86-64/property-x86-shstk3b.d
|
||||
index 5216f38..f66a40e 100644
|
||||
--- a/ld/testsuite/ld-x86-64/property-x86-shstk3b.d
|
||||
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk3b.d
|
||||
@@ -6,6 +6,5 @@
|
||||
|
||||
Displaying notes found in: .note.gnu.property
|
||||
Owner Data size Description
|
||||
- GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
|
||||
- Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
|
||||
- x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
|
||||
+ Properties: x86 ISA needed: i486, 586, SSE2, SSE3
|
||||
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
|
||||
index 6edb9e8..ae21e55 100644
|
||||
--- a/ld/testsuite/ld-x86-64/x86-64.exp
|
||||
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
|
||||
@@ -403,6 +403,10 @@ run_dump_test "pr23372a"
|
||||
run_dump_test "pr23372a-x32"
|
||||
run_dump_test "pr23372b"
|
||||
run_dump_test "pr23372b-x32"
|
||||
+run_dump_test "pr23486a"
|
||||
+run_dump_test "pr23486a-x32"
|
||||
+run_dump_test "pr23486b"
|
||||
+run_dump_test "pr23486b-x32"
|
||||
|
||||
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
|
||||
return
|
||||
--
|
||||
2.9.3
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
From 28a27bdbb9500797e6767f80c8128b09112aeed5 Mon Sep 17 00:00:00 2001
|
||||
From: "H.J. Lu" <hjl.tools@gmail.com>
|
||||
Date: Sat, 11 Aug 2018 06:41:33 -0700
|
||||
Subject: [PATCH] x86: Properly add X86_ISA_1_NEEDED property
|
||||
|
||||
Existing properties may be removed during property merging. We avoid
|
||||
adding X86_ISA_1_NEEDED property only if existing properties won't be
|
||||
removed.
|
||||
|
||||
bfd/
|
||||
|
||||
PR ld/23428
|
||||
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Don't
|
||||
add X86_ISA_1_NEEDED property only if existing properties won't
|
||||
be removed.
|
||||
|
||||
ld/
|
||||
|
||||
PR ld/23428
|
||||
* testsuite/ld-elf/dummy.s: New file.
|
||||
* testsuite/ld-elf/linux-x86.S: Add X86_FEATURE_1_AND property.
|
||||
* testsuite/ld-elf/linux-x86.exp: Add dummy.s to pr23428.
|
||||
|
||||
(cherry picked from commit ab9e342807d132182892de1be1a92d6e91a5c1da)
|
||||
Signed-off-by: Norbert Lange <nolange79@gmail.com>
|
||||
---
|
||||
bfd/ChangeLog | 7 +++++++
|
||||
bfd/elfxx-x86.c | 28 ++++++++++++++++++++++------
|
||||
ld/ChangeLog | 7 +++++++
|
||||
ld/testsuite/ld-elf/dummy.s | 1 +
|
||||
ld/testsuite/ld-elf/linux-x86.S | 28 ++++++++++++++++++++++++++++
|
||||
ld/testsuite/ld-elf/linux-x86.exp | 2 +-
|
||||
6 files changed, 66 insertions(+), 7 deletions(-)
|
||||
create mode 100644 ld/testsuite/ld-elf/dummy.s
|
||||
|
||||
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
|
||||
index 7ccfd25..2d8f7b6 100644
|
||||
--- a/bfd/elfxx-x86.c
|
||||
+++ b/bfd/elfxx-x86.c
|
||||
@@ -2588,7 +2588,6 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
prop->pr_kind = property_number;
|
||||
}
|
||||
else if (has_text
|
||||
- && elf_properties (ebfd) == NULL
|
||||
&& elf_tdata (info->output_bfd)->o->build_id.sec == NULL
|
||||
&& !htab->elf.dynamic_sections_created
|
||||
&& !info->traditional_format
|
||||
@@ -2598,11 +2597,28 @@ _bfd_x86_elf_link_setup_gnu_properties
|
||||
/* If the separate code program header is needed, make sure
|
||||
that the first read-only PT_LOAD segment has no code by
|
||||
adding a GNU_PROPERTY_X86_ISA_1_NEEDED note. */
|
||||
- prop = _bfd_elf_get_property (ebfd,
|
||||
- GNU_PROPERTY_X86_ISA_1_NEEDED,
|
||||
- 4);
|
||||
- prop->u.number = GNU_PROPERTY_X86_ISA_1_486;
|
||||
- prop->pr_kind = property_number;
|
||||
+ elf_property_list *list;
|
||||
+ bfd_boolean need_property = TRUE;
|
||||
+
|
||||
+ for (list = elf_properties (ebfd); list; list = list->next)
|
||||
+ switch (list->property.pr_type)
|
||||
+ {
|
||||
+ case GNU_PROPERTY_STACK_SIZE:
|
||||
+ case GNU_PROPERTY_NO_COPY_ON_PROTECTED:
|
||||
+ case GNU_PROPERTY_X86_ISA_1_NEEDED:
|
||||
+ /* These properties won't be removed during merging. */
|
||||
+ need_property = FALSE;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (need_property)
|
||||
+ {
|
||||
+ prop = _bfd_elf_get_property (ebfd,
|
||||
+ GNU_PROPERTY_X86_ISA_1_NEEDED,
|
||||
+ 4);
|
||||
+ prop->u.number = GNU_PROPERTY_X86_ISA_1_486;
|
||||
+ prop->pr_kind = property_number;
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Create the GNU property note section if needed. */
|
||||
diff --git a/ld/testsuite/ld-elf/dummy.s b/ld/testsuite/ld-elf/dummy.s
|
||||
new file mode 100644
|
||||
index 0000000..403f980
|
||||
--- /dev/null
|
||||
+++ b/ld/testsuite/ld-elf/dummy.s
|
||||
@@ -0,0 +1 @@
|
||||
+# Dummy
|
||||
diff --git a/ld/testsuite/ld-elf/linux-x86.S b/ld/testsuite/ld-elf/linux-x86.S
|
||||
index bdf40c6..d94abc1 100644
|
||||
--- a/ld/testsuite/ld-elf/linux-x86.S
|
||||
+++ b/ld/testsuite/ld-elf/linux-x86.S
|
||||
@@ -61,3 +61,31 @@ syscall:
|
||||
ret /* Return to caller. */
|
||||
.size syscall, .-syscall
|
||||
.section .note.GNU-stack,"",@progbits
|
||||
+
|
||||
+ .section ".note.gnu.property", "a"
|
||||
+#ifdef __LP64__
|
||||
+ .p2align 3
|
||||
+#else
|
||||
+ .p2align 2
|
||||
+#endif
|
||||
+ .long 1f - 0f /* name length */
|
||||
+ .long 5f - 2f /* data length */
|
||||
+ .long 5 /* note type */
|
||||
+0: .asciz "GNU" /* vendor name */
|
||||
+1:
|
||||
+#ifdef __LP64__
|
||||
+ .p2align 3
|
||||
+#else
|
||||
+ .p2align 2
|
||||
+#endif
|
||||
+2: .long 0xc0000002 /* pr_type. */
|
||||
+ .long 4f - 3f /* pr_datasz. */
|
||||
+3:
|
||||
+ .long 0x2
|
||||
+4:
|
||||
+#ifdef __LP64__
|
||||
+ .p2align 3
|
||||
+#else
|
||||
+ .p2align 2
|
||||
+#endif
|
||||
+5:
|
||||
diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp
|
||||
index 36217c6..f6f5a80 100644
|
||||
--- a/ld/testsuite/ld-elf/linux-x86.exp
|
||||
+++ b/ld/testsuite/ld-elf/linux-x86.exp
|
||||
@@ -37,7 +37,7 @@ run_ld_link_exec_tests [list \
|
||||
"Run PR ld/23428 test" \
|
||||
"--no-dynamic-linker -z separate-code" \
|
||||
"" \
|
||||
- { linux-x86.S pr23428.c } \
|
||||
+ { linux-x86.S pr23428.c dummy.s } \
|
||||
"pr23428" \
|
||||
"pass.out" \
|
||||
"$NOPIE_CFLAGS -fno-asynchronous-unwind-tables" \
|
||||
--
|
||||
2.9.3
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 278989f23735aa501be1052e085540c75c126dbb Mon Sep 17 00:00:00 2001
|
||||
From: Max Filippov <jcmvbkbc@gmail.com>
|
||||
Date: Thu, 28 Mar 2019 17:03:57 -0700
|
||||
Subject: [PATCH] bfd: xtensa: fix shrink_dynamic_reloc_sections for
|
||||
export-dynamic
|
||||
|
||||
shrink_dynamic_reloc_sections must remove PLT entry that was created for
|
||||
an undefined weak symbol in the presence of --export-dynamic option when
|
||||
relaxation coalesces literals pointing to that symbol. This fixes the
|
||||
following assertion:
|
||||
|
||||
ld: BFD (GNU Binutils) 2.31.1 internal error, aborting at
|
||||
elf32-xtensa.c:3292 in elf_xtensa_finish_dynamic_sections
|
||||
|
||||
2019-03-28 Max Filippov <jcmvbkbc@gmail.com>
|
||||
bfd/
|
||||
* elf32-xtensa.c (shrink_dynamic_reloc_sections): Add
|
||||
info->export_dynamic to the conditional.
|
||||
|
||||
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
||||
---
|
||||
bfd/elf32-xtensa.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
|
||||
index c3df3d6db756..37ea200eea74 100644
|
||||
--- a/bfd/elf32-xtensa.c
|
||||
+++ b/bfd/elf32-xtensa.c
|
||||
@@ -10083,7 +10083,8 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (dynamic_symbol || bfd_link_pic (info))
|
||||
&& (!h || h->root.type != bfd_link_hash_undefweak
|
||||
- || (dynamic_symbol && bfd_link_dll (info))))
|
||||
+ || (dynamic_symbol
|
||||
+ && (bfd_link_dll (info) || info->export_dynamic))))
|
||||
{
|
||||
asection *srel;
|
||||
bfd_boolean is_plt = FALSE;
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,294 @@
|
||||
From 0dbdfb7918d0b0cfcb8883b24c1291574bf5bb7c Mon Sep 17 00:00:00 2001
|
||||
From: Max Filippov <jcmvbkbc@gmail.com>
|
||||
Date: Tue, 2 Apr 2019 14:32:42 -0700
|
||||
Subject: [PATCH] gas: use literals/const16 for xtensa loop relaxation
|
||||
|
||||
Loop opcode relaxation that uses addi/addmi doesn't work well with other
|
||||
relaxations that may cause code movement. Instead of encoding fixed loop
|
||||
end offset in the relaxed sequence use l32r or a pair of const16 to load
|
||||
loop end address. This way the address of the loop end gets a relocation
|
||||
record and it gets updated appropriately.
|
||||
|
||||
gas/
|
||||
2019-04-02 Max Filippov <jcmvbkbc@gmail.com>
|
||||
|
||||
* config/tc-xtensa.c (convert_frag_immed): Drop
|
||||
convert_frag_immed_finish_loop invocation.
|
||||
(convert_frag_immed_finish_loop): Drop declaration and
|
||||
definition.
|
||||
* config/xtensa-relax.c (widen_spec_list): Replace loop
|
||||
widening that uses addi/addmi with widening that uses l32r
|
||||
and const16.
|
||||
|
||||
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
||||
---
|
||||
gas/config/tc-xtensa.c | 120 ----------------------------------------------
|
||||
gas/config/xtensa-relax.c | 77 ++++++++++++++++++++---------
|
||||
2 files changed, 55 insertions(+), 142 deletions(-)
|
||||
|
||||
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
|
||||
index 3bdbbc931cfc..0cc06361cf6f 100644
|
||||
--- a/gas/config/tc-xtensa.c
|
||||
+++ b/gas/config/tc-xtensa.c
|
||||
@@ -10668,7 +10668,6 @@ convert_frag_fill_nop (fragS *fragP)
|
||||
static fixS *fix_new_exp_in_seg
|
||||
(segT, subsegT, fragS *, int, int, expressionS *, int,
|
||||
bfd_reloc_code_real_type);
|
||||
-static void convert_frag_immed_finish_loop (segT, fragS *, TInsn *);
|
||||
|
||||
static void
|
||||
convert_frag_immed (segT segP,
|
||||
@@ -10910,9 +10909,6 @@ convert_frag_immed (segT segP,
|
||||
}
|
||||
}
|
||||
|
||||
- if (expanded && xtensa_opcode_is_loop (isa, orig_tinsn.opcode) == 1)
|
||||
- convert_frag_immed_finish_loop (segP, fragP, &orig_tinsn);
|
||||
-
|
||||
if (expanded && is_direct_call_opcode (orig_tinsn.opcode))
|
||||
{
|
||||
/* Add an expansion note on the expanded instruction. */
|
||||
@@ -10949,122 +10945,6 @@ fix_new_exp_in_seg (segT new_seg,
|
||||
}
|
||||
|
||||
|
||||
-/* Relax a loop instruction so that it can span loop >256 bytes.
|
||||
-
|
||||
- loop as, .L1
|
||||
- .L0:
|
||||
- rsr as, LEND
|
||||
- wsr as, LBEG
|
||||
- addi as, as, lo8 (label-.L1)
|
||||
- addmi as, as, mid8 (label-.L1)
|
||||
- wsr as, LEND
|
||||
- isync
|
||||
- rsr as, LCOUNT
|
||||
- addi as, as, 1
|
||||
- .L1:
|
||||
- <<body>>
|
||||
- label:
|
||||
-*/
|
||||
-
|
||||
-static void
|
||||
-convert_frag_immed_finish_loop (segT segP, fragS *fragP, TInsn *tinsn)
|
||||
-{
|
||||
- TInsn loop_insn;
|
||||
- TInsn addi_insn;
|
||||
- TInsn addmi_insn;
|
||||
- unsigned long target;
|
||||
- static xtensa_insnbuf insnbuf = NULL;
|
||||
- unsigned int loop_length, loop_length_hi, loop_length_lo;
|
||||
- xtensa_isa isa = xtensa_default_isa;
|
||||
- addressT loop_offset;
|
||||
- addressT addi_offset = 9;
|
||||
- addressT addmi_offset = 12;
|
||||
- fragS *next_fragP;
|
||||
- int target_count;
|
||||
-
|
||||
- if (!insnbuf)
|
||||
- insnbuf = xtensa_insnbuf_alloc (isa);
|
||||
-
|
||||
- /* Get the loop offset. */
|
||||
- loop_offset = get_expanded_loop_offset (tinsn->opcode);
|
||||
-
|
||||
- /* Validate that there really is a LOOP at the loop_offset. Because
|
||||
- loops are not bundleable, we can assume that the instruction will be
|
||||
- in slot 0. */
|
||||
- tinsn_from_chars (&loop_insn, fragP->fr_opcode + loop_offset, 0);
|
||||
- tinsn_immed_from_frag (&loop_insn, fragP, 0);
|
||||
-
|
||||
- gas_assert (xtensa_opcode_is_loop (isa, loop_insn.opcode) == 1);
|
||||
- addi_offset += loop_offset;
|
||||
- addmi_offset += loop_offset;
|
||||
-
|
||||
- gas_assert (tinsn->ntok == 2);
|
||||
- if (tinsn->tok[1].X_op == O_constant)
|
||||
- target = tinsn->tok[1].X_add_number;
|
||||
- else if (tinsn->tok[1].X_op == O_symbol)
|
||||
- {
|
||||
- /* Find the fragment. */
|
||||
- symbolS *sym = tinsn->tok[1].X_add_symbol;
|
||||
- gas_assert (S_GET_SEGMENT (sym) == segP
|
||||
- || S_GET_SEGMENT (sym) == absolute_section);
|
||||
- target = (S_GET_VALUE (sym) + tinsn->tok[1].X_add_number);
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- as_bad (_("invalid expression evaluation type %d"), tinsn->tok[1].X_op);
|
||||
- target = 0;
|
||||
- }
|
||||
-
|
||||
- loop_length = target - (fragP->fr_address + fragP->fr_fix);
|
||||
- loop_length_hi = loop_length & ~0x0ff;
|
||||
- loop_length_lo = loop_length & 0x0ff;
|
||||
- if (loop_length_lo >= 128)
|
||||
- {
|
||||
- loop_length_lo -= 256;
|
||||
- loop_length_hi += 256;
|
||||
- }
|
||||
-
|
||||
- /* Because addmi sign-extends the immediate, 'loop_length_hi' can be at most
|
||||
- 32512. If the loop is larger than that, then we just fail. */
|
||||
- if (loop_length_hi > 32512)
|
||||
- as_bad_where (fragP->fr_file, fragP->fr_line,
|
||||
- _("loop too long for LOOP instruction"));
|
||||
-
|
||||
- tinsn_from_chars (&addi_insn, fragP->fr_opcode + addi_offset, 0);
|
||||
- gas_assert (addi_insn.opcode == xtensa_addi_opcode);
|
||||
-
|
||||
- tinsn_from_chars (&addmi_insn, fragP->fr_opcode + addmi_offset, 0);
|
||||
- gas_assert (addmi_insn.opcode == xtensa_addmi_opcode);
|
||||
-
|
||||
- set_expr_const (&addi_insn.tok[2], loop_length_lo);
|
||||
- tinsn_to_insnbuf (&addi_insn, insnbuf);
|
||||
-
|
||||
- fragP->tc_frag_data.is_insn = TRUE;
|
||||
- xtensa_insnbuf_to_chars
|
||||
- (isa, insnbuf, (unsigned char *) fragP->fr_opcode + addi_offset, 0);
|
||||
-
|
||||
- set_expr_const (&addmi_insn.tok[2], loop_length_hi);
|
||||
- tinsn_to_insnbuf (&addmi_insn, insnbuf);
|
||||
- xtensa_insnbuf_to_chars
|
||||
- (isa, insnbuf, (unsigned char *) fragP->fr_opcode + addmi_offset, 0);
|
||||
-
|
||||
- /* Walk through all of the frags from here to the loop end
|
||||
- and mark them as no_transform to keep them from being modified
|
||||
- by the linker. If we ever have a relocation for the
|
||||
- addi/addmi of the difference of two symbols we can remove this. */
|
||||
-
|
||||
- target_count = 0;
|
||||
- for (next_fragP = fragP; next_fragP != NULL;
|
||||
- next_fragP = next_fragP->fr_next)
|
||||
- {
|
||||
- next_fragP->tc_frag_data.is_no_transform = TRUE;
|
||||
- if (next_fragP->tc_frag_data.is_loop_target)
|
||||
- target_count++;
|
||||
- if (target_count == 2)
|
||||
- break;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
|
||||
/* A map that keeps information on a per-subsegment basis. This is
|
||||
maintained during initial assembly, but is invalid once the
|
||||
diff --git a/gas/config/xtensa-relax.c b/gas/config/xtensa-relax.c
|
||||
index cb296ed85ed2..daf15d52c259 100644
|
||||
--- a/gas/config/xtensa-relax.c
|
||||
+++ b/gas/config/xtensa-relax.c
|
||||
@@ -87,13 +87,7 @@
|
||||
when the first and second operands are not the same as specified
|
||||
by the "| %at!=%as" precondition clause.
|
||||
{"l32i %at,%as,%imm | %at!=%as",
|
||||
- "LITERAL %imm; l32r %at,%LITERAL; add %at,%at,%as; l32i %at,%at,0"}
|
||||
-
|
||||
- There is special case for loop instructions here, but because we do
|
||||
- not currently have the ability to represent the difference of two
|
||||
- symbols, the conversion requires special code in the assembler to
|
||||
- write the operands of the addi/addmi pair representing the
|
||||
- difference of the old and new loop end label. */
|
||||
+ "LITERAL %imm; l32r %at,%LITERAL; add %at,%at,%as; l32i %at,%at,0"} */
|
||||
|
||||
#include "as.h"
|
||||
#include "xtensa-isa.h"
|
||||
@@ -306,44 +300,83 @@ static string_pattern_pair widen_spec_list[] =
|
||||
{"l32i %at,%as,%imm | %at!=%as ? IsaUseConst16",
|
||||
"const16 %at,HI16U(%imm); const16 %at,LOW16U(%imm); add %at,%at,%as; l32i %at,%at,0"},
|
||||
|
||||
- /* This is only PART of the loop instruction. In addition,
|
||||
- hardcoded into its use is a modification of the final operand in
|
||||
- the instruction in bytes 9 and 12. */
|
||||
- {"loop %as,%label | %as!=1 ? IsaUseLoops",
|
||||
+ /* Widening loops with literals. */
|
||||
+ {"loop %as,%label | %as!=1 ? IsaUseLoops ? IsaUseL32R",
|
||||
+ "loop %as,%LABEL;"
|
||||
+ "rsr.lend %as;" /* LEND */
|
||||
+ "wsr.lbeg %as;" /* LBEG */
|
||||
+ "LITERAL %label;"
|
||||
+ "l32r %as, %LITERAL;"
|
||||
+ "nop;"
|
||||
+ "wsr.lend %as;"
|
||||
+ "isync;"
|
||||
+ "rsr.lcount %as;" /* LCOUNT */
|
||||
+ "addi %as, %as, 1;"
|
||||
+ "LABEL"},
|
||||
+ {"loopgtz %as,%label | %as!=1 ? IsaUseLoops ? IsaUseL32R",
|
||||
+ "beqz %as,%label;"
|
||||
+ "bltz %as,%label;"
|
||||
+ "loopgtz %as,%LABEL;"
|
||||
+ "rsr.lend %as;" /* LEND */
|
||||
+ "wsr.lbeg %as;" /* LBEG */
|
||||
+ "LITERAL %label;"
|
||||
+ "l32r %as, %LITERAL;"
|
||||
+ "nop;"
|
||||
+ "wsr.lend %as;"
|
||||
+ "isync;"
|
||||
+ "rsr.lcount %as;" /* LCOUNT */
|
||||
+ "addi %as, %as, 1;"
|
||||
+ "LABEL"},
|
||||
+ {"loopnez %as,%label | %as!=1 ? IsaUseLoops ? IsaUseL32R",
|
||||
+ "beqz %as,%label;"
|
||||
+ "loopnez %as,%LABEL;"
|
||||
+ "rsr.lend %as;" /* LEND */
|
||||
+ "wsr.lbeg %as;" /* LBEG */
|
||||
+ "LITERAL %label;"
|
||||
+ "l32r %as, %LITERAL;"
|
||||
+ "nop;"
|
||||
+ "wsr.lend %as;"
|
||||
+ "isync;"
|
||||
+ "rsr.lcount %as;" /* LCOUNT */
|
||||
+ "addi %as, %as, 1;"
|
||||
+ "LABEL"},
|
||||
+
|
||||
+ /* Widening loops with const16. */
|
||||
+ {"loop %as,%label | %as!=1 ? IsaUseLoops ? IsaUseConst16",
|
||||
"loop %as,%LABEL;"
|
||||
"rsr.lend %as;" /* LEND */
|
||||
"wsr.lbeg %as;" /* LBEG */
|
||||
- "addi %as, %as, 0;" /* lo8(%label-%LABEL1) */
|
||||
- "addmi %as, %as, 0;" /* mid8(%label-%LABEL1) */
|
||||
+ "const16 %as,HI16U(%label);"
|
||||
+ "const16 %as,LOW16U(%label);"
|
||||
"wsr.lend %as;"
|
||||
"isync;"
|
||||
"rsr.lcount %as;" /* LCOUNT */
|
||||
- "addi %as, %as, 1;" /* density -> addi.n %as, %as, 1 */
|
||||
+ "addi %as, %as, 1;"
|
||||
"LABEL"},
|
||||
- {"loopgtz %as,%label | %as!=1 ? IsaUseLoops",
|
||||
+ {"loopgtz %as,%label | %as!=1 ? IsaUseLoops ? IsaUseConst16",
|
||||
"beqz %as,%label;"
|
||||
"bltz %as,%label;"
|
||||
"loopgtz %as,%LABEL;"
|
||||
"rsr.lend %as;" /* LEND */
|
||||
"wsr.lbeg %as;" /* LBEG */
|
||||
- "addi %as, %as, 0;" /* lo8(%label-%LABEL1) */
|
||||
- "addmi %as, %as, 0;" /* mid8(%label-%LABEL1) */
|
||||
+ "const16 %as,HI16U(%label);"
|
||||
+ "const16 %as,LOW16U(%label);"
|
||||
"wsr.lend %as;"
|
||||
"isync;"
|
||||
"rsr.lcount %as;" /* LCOUNT */
|
||||
- "addi %as, %as, 1;" /* density -> addi.n %as, %as, 1 */
|
||||
+ "addi %as, %as, 1;"
|
||||
"LABEL"},
|
||||
- {"loopnez %as,%label | %as!=1 ? IsaUseLoops",
|
||||
+ {"loopnez %as,%label | %as!=1 ? IsaUseLoops ? IsaUseConst16",
|
||||
"beqz %as,%label;"
|
||||
"loopnez %as,%LABEL;"
|
||||
"rsr.lend %as;" /* LEND */
|
||||
"wsr.lbeg %as;" /* LBEG */
|
||||
- "addi %as, %as, 0;" /* lo8(%label-%LABEL1) */
|
||||
- "addmi %as, %as, 0;" /* mid8(%label-%LABEL1) */
|
||||
+ "const16 %as,HI16U(%label);"
|
||||
+ "const16 %as,LOW16U(%label);"
|
||||
"wsr.lend %as;"
|
||||
"isync;"
|
||||
"rsr.lcount %as;" /* LCOUNT */
|
||||
- "addi %as, %as, 1;" /* density -> addi.n %as, %as, 1 */
|
||||
+ "addi %as, %as, 1;"
|
||||
"LABEL"},
|
||||
|
||||
/* Relaxing to wide branches. Order is important here. With wide
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
From 471702ac4a57878a06e8167f063274cf413e548d Mon Sep 17 00:00:00 2001
|
||||
From: Max Filippov <jcmvbkbc@gmail.com>
|
||||
Date: Mon, 8 Apr 2019 13:47:18 -0700
|
||||
Subject: [PATCH] xtensa: gas: put .literal_position at section start
|
||||
|
||||
Provide literal position at the beginning of each section for literal
|
||||
space reserved by relaxations when text-section-literals or
|
||||
auto-litpools options are used. Remove code that adds fill frag to the
|
||||
literal section for every .literal_position directive to avoid creation
|
||||
of empty literal sections.
|
||||
|
||||
Fix auto-litpools tests that got literal pool address changes.
|
||||
|
||||
gas/
|
||||
2019-04-11 Max Filippov <jcmvbkbc@gmail.com>
|
||||
|
||||
* config/tc-xtensa.c (xtensa_is_init_fini): Add declaration.
|
||||
(xtensa_mark_literal_pool_location): Don't add fill frag to literal
|
||||
section that records literal pool location.
|
||||
(md_begin): Call xtensa_mark_literal_pool_location when text
|
||||
section literals or auto litpools are used.
|
||||
(xtensa_elf_section_change_hook): Call
|
||||
xtensa_mark_literal_pool_location when text section literals or
|
||||
auto litpools are used, there's no literal pool location defined
|
||||
for the current section and it's not .init or .fini.
|
||||
|
||||
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
|
||||
---
|
||||
gas/config/tc-xtensa.c | 22 +++++++++-------------
|
||||
1 file changed, 9 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
|
||||
index 0cc06361cf6f..6a80e76fed8c 100644
|
||||
--- a/gas/config/tc-xtensa.c
|
||||
+++ b/gas/config/tc-xtensa.c
|
||||
@@ -497,6 +497,7 @@ static fixS *xg_append_jump (fragS *fragP, symbolS *sym, offsetT offset);
|
||||
static void xtensa_maybe_create_literal_pool_frag (bfd_boolean, bfd_boolean);
|
||||
static bfd_boolean auto_litpools = FALSE;
|
||||
static int auto_litpool_limit = 0;
|
||||
+static bfd_boolean xtensa_is_init_fini (segT seg);
|
||||
|
||||
/* Alignment Functions. */
|
||||
|
||||
@@ -4797,7 +4798,6 @@ xtensa_mark_literal_pool_location (void)
|
||||
{
|
||||
/* Any labels pointing to the current location need
|
||||
to be adjusted to after the literal pool. */
|
||||
- emit_state s;
|
||||
fragS *pool_location;
|
||||
|
||||
if (use_literal_section)
|
||||
@@ -4818,19 +4818,7 @@ xtensa_mark_literal_pool_location (void)
|
||||
RELAX_LITERAL_POOL_END, NULL, 0, NULL);
|
||||
xtensa_set_frag_assembly_state (frag_now);
|
||||
|
||||
- /* Now put a frag into the literal pool that points to this location. */
|
||||
set_literal_pool_location (now_seg, pool_location);
|
||||
- xtensa_switch_to_non_abs_literal_fragment (&s);
|
||||
- frag_align (2, 0, 0);
|
||||
- record_alignment (now_seg, 2);
|
||||
-
|
||||
- /* Close whatever frag is there. */
|
||||
- frag_variant (rs_fill, 0, 0, 0, NULL, 0, NULL);
|
||||
- xtensa_set_frag_assembly_state (frag_now);
|
||||
- frag_now->tc_frag_data.literal_frag = pool_location;
|
||||
- frag_variant (rs_fill, 0, 0, 0, NULL, 0, NULL);
|
||||
- xtensa_restore_emit_state (&s);
|
||||
- xtensa_set_frag_assembly_state (frag_now);
|
||||
}
|
||||
|
||||
|
||||
@@ -5334,6 +5322,9 @@ md_begin (void)
|
||||
/* Set up the assembly state. */
|
||||
if (!frag_now->tc_frag_data.is_assembly_state_set)
|
||||
xtensa_set_frag_assembly_state (frag_now);
|
||||
+
|
||||
+ if (!use_literal_section)
|
||||
+ xtensa_mark_literal_pool_location ();
|
||||
}
|
||||
|
||||
|
||||
@@ -5933,6 +5924,11 @@ xtensa_elf_section_change_hook (void)
|
||||
/* Set up the assembly state. */
|
||||
if (!frag_now->tc_frag_data.is_assembly_state_set)
|
||||
xtensa_set_frag_assembly_state (frag_now);
|
||||
+
|
||||
+ if (!use_literal_section
|
||||
+ && seg_info (now_seg)->tc_segment_info_data.literal_pool_loc == NULL
|
||||
+ && !xtensa_is_init_fini (now_seg))
|
||||
+ xtensa_mark_literal_pool_location ();
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.11.0
|
||||
|
||||
@@ -31,13 +31,13 @@ config BR2_BINUTILS_VERSION_2_31_X
|
||||
bool "binutils 2.31.1"
|
||||
|
||||
config BR2_BINUTILS_VERSION_ARC
|
||||
bool "binutils arc (2.29)"
|
||||
bool "binutils arc (2.31)"
|
||||
depends on BR2_arc
|
||||
endchoice
|
||||
|
||||
config BR2_BINUTILS_VERSION
|
||||
string
|
||||
default "arc-2018.03" if BR2_BINUTILS_VERSION_ARC
|
||||
default "arc-2018.09-release" if BR2_BINUTILS_VERSION_ARC
|
||||
default "2.28.1" if BR2_BINUTILS_VERSION_2_28_X
|
||||
default "2.29.1" if BR2_BINUTILS_VERSION_2_29_X
|
||||
default "2.30" if BR2_BINUTILS_VERSION_2_30_X
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
From d4e18ebc6ad810167a2de84b185a5f0d65b9ec2d Mon Sep 17 00:00:00 2001
|
||||
From: Romain Naour <romain.naour@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 11:40:53 +0100
|
||||
Subject: [PATCH] ld-makefile
|
||||
|
||||
[Romain: rebase on top of 2.26]
|
||||
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
||||
---
|
||||
ld/Makefile.am | 2 +-
|
||||
ld/Makefile.in | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ld/Makefile.am b/ld/Makefile.am
|
||||
index 625347f..d5334d2 100644
|
||||
--- a/ld/Makefile.am
|
||||
+++ b/ld/Makefile.am
|
||||
@@ -57,7 +57,7 @@ endif
|
||||
# We put the scripts in the directory $(scriptdir)/ldscripts.
|
||||
# We can't put the scripts in $(datadir) because the SEARCH_DIR
|
||||
# directives need to be different for native and cross linkers.
|
||||
-scriptdir = $(tooldir)/lib
|
||||
+scriptdir = $(libdir)
|
||||
|
||||
EMUL = @EMUL@
|
||||
EMULATION_OFILES = @EMULATION_OFILES@
|
||||
diff --git a/ld/Makefile.in b/ld/Makefile.in
|
||||
index ba25177..a2cf228 100644
|
||||
--- a/ld/Makefile.in
|
||||
+++ b/ld/Makefile.in
|
||||
@@ -446,7 +446,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS)
|
||||
# We put the scripts in the directory $(scriptdir)/ldscripts.
|
||||
# We can't put the scripts in $(datadir) because the SEARCH_DIR
|
||||
# directives need to be different for native and cross linkers.
|
||||
-scriptdir = $(tooldir)/lib
|
||||
+scriptdir = $(libdir)
|
||||
BASEDIR = $(srcdir)/..
|
||||
BFDDIR = $(BASEDIR)/bfd
|
||||
INCDIR = $(BASEDIR)/include
|
||||
--
|
||||
2.9.4
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
From 3bd211025c890ef2971958915d500a9bb2913a2a Mon Sep 17 00:00:00 2001
|
||||
From: Romain Naour <romain.naour@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 11:41:47 +0100
|
||||
Subject: [PATCH] check-ldrunpath-length
|
||||
|
||||
[Romain: rebase on top of 2.26]
|
||||
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
||||
---
|
||||
ld/emultempl/elf32.em | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
|
||||
index d2551b6..70fcb56 100644
|
||||
--- a/ld/emultempl/elf32.em
|
||||
+++ b/ld/emultempl/elf32.em
|
||||
@@ -1463,6 +1463,8 @@ fragment <<EOF
|
||||
&& command_line.rpath == NULL)
|
||||
{
|
||||
path = (const char *) getenv ("LD_RUN_PATH");
|
||||
+ if ((path) && (strlen (path) == 0))
|
||||
+ path = NULL;
|
||||
if (path
|
||||
&& gld${EMULATION_NAME}_search_needed (path, &n, force))
|
||||
break;
|
||||
@@ -1740,6 +1742,8 @@ gld${EMULATION_NAME}_before_allocation (void)
|
||||
rpath = command_line.rpath;
|
||||
if (rpath == NULL)
|
||||
rpath = (const char *) getenv ("LD_RUN_PATH");
|
||||
+ if ((rpath) && (strlen (rpath) == 0))
|
||||
+ rpath = NULL;
|
||||
|
||||
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
|
||||
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
|
||||
--
|
||||
2.9.4
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
From 378bda0e19d279535b3f4a0e448a658a534a5d67 Mon Sep 17 00:00:00 2001
|
||||
From: Romain Naour <romain.naour@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 11:42:48 +0100
|
||||
Subject: [PATCH] add sysroot fix from bug #3049
|
||||
|
||||
Always try to prepend the sysroot prefix to absolute filenames first.
|
||||
|
||||
http://bugs.gentoo.org/275666
|
||||
http://sourceware.org/bugzilla/show_bug.cgi?id=10340
|
||||
|
||||
Signed-off-by: Sven Rebhan <odinshorse@googlemail.com>
|
||||
[Romain: rebase on top of 2.26]
|
||||
Signed-off-by: Romain Naour <romain.naour@gmail.com>
|
||||
---
|
||||
ld/ldfile.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/ld/ldfile.c b/ld/ldfile.c
|
||||
index 3b37a0a..f7e5473 100644
|
||||
--- a/ld/ldfile.c
|
||||
+++ b/ld/ldfile.c
|
||||
@@ -338,18 +338,24 @@ ldfile_open_file_search (const char *arch,
|
||||
directory first. */
|
||||
if (!entry->flags.maybe_archive)
|
||||
{
|
||||
- if (entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename))
|
||||
+ /* For absolute pathnames, try to always open the file in the
|
||||
+ sysroot first. If this fails, try to open the file at the
|
||||
+ given location. */
|
||||
+ entry->flags.sysrooted = is_sysrooted_pathname (entry->filename);
|
||||
+ if (!entry->flags.sysrooted && IS_ABSOLUTE_PATH (entry->filename)
|
||||
+ && ld_sysroot)
|
||||
{
|
||||
char *name = concat (ld_sysroot, entry->filename,
|
||||
(const char *) NULL);
|
||||
if (ldfile_try_open_bfd (name, entry))
|
||||
{
|
||||
entry->filename = name;
|
||||
+ entry->flags.sysrooted = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
free (name);
|
||||
}
|
||||
- else if (ldfile_try_open_bfd (entry->filename, entry))
|
||||
+ if (ldfile_try_open_bfd (entry->filename, entry))
|
||||
return TRUE;
|
||||
|
||||
if (IS_ABSOLUTE_PATH (entry->filename))
|
||||
--
|
||||
2.9.4
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From b100e9d16bfe6725b2624902af457ecfa490b150 Mon Sep 17 00:00:00 2001
|
||||
From 7d1e6ed1d57e839207e0ece7561bd4709032de9f Mon Sep 17 00:00:00 2001
|
||||
From: Romain Naour <romain.naour@gmail.com>
|
||||
Date: Fri, 25 Dec 2015 11:45:38 +0100
|
||||
Subject: [PATCH] poison-system-directories
|
||||
@@ -70,7 +70,7 @@ Signed-off-by: Scott Garman <scott.a.garman@intel.com>
|
||||
ld/configure | 14 ++++++++++++++
|
||||
ld/configure.ac | 10 ++++++++++
|
||||
ld/ld.h | 8 ++++++++
|
||||
ld/ld.texinfo | 12 ++++++++++++
|
||||
ld/ld.texi | 12 ++++++++++++
|
||||
ld/ldfile.c | 17 +++++++++++++++++
|
||||
ld/ldlex.h | 2 ++
|
||||
ld/ldmain.c | 2 ++
|
||||
@@ -78,10 +78,10 @@ Signed-off-by: Scott Garman <scott.a.garman@intel.com>
|
||||
9 files changed, 89 insertions(+)
|
||||
|
||||
diff --git a/ld/config.in b/ld/config.in
|
||||
index 5d91380..ffe84a7 100644
|
||||
index d93c9b0..5da2742 100644
|
||||
--- a/ld/config.in
|
||||
+++ b/ld/config.in
|
||||
@@ -21,6 +21,9 @@
|
||||
@@ -31,6 +31,9 @@
|
||||
language is requested. */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
@@ -92,10 +92,10 @@ index 5d91380..ffe84a7 100644
|
||||
#undef EXTRA_SHLIB_EXTENSION
|
||||
|
||||
diff --git a/ld/configure b/ld/configure
|
||||
index da20ab5..63e3da7 100755
|
||||
index 300a272..d68890f 100755
|
||||
--- a/ld/configure
|
||||
+++ b/ld/configure
|
||||
@@ -785,6 +785,7 @@ with_lib_path
|
||||
@@ -822,6 +822,7 @@ with_lib_path
|
||||
enable_targets
|
||||
enable_64_bit_bfd
|
||||
with_sysroot
|
||||
@@ -103,7 +103,7 @@ index da20ab5..63e3da7 100755
|
||||
enable_gold
|
||||
enable_got
|
||||
enable_compressed_debug_sections
|
||||
@@ -1443,6 +1444,8 @@ Optional Features:
|
||||
@@ -1486,6 +1487,8 @@ Optional Features:
|
||||
--disable-largefile omit support for large files
|
||||
--enable-targets alternative target configurations
|
||||
--enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)
|
||||
@@ -112,7 +112,7 @@ index da20ab5..63e3da7 100755
|
||||
--enable-gold[=ARG] build gold [ARG={default,yes,no}]
|
||||
--enable-got=<type> GOT handling scheme (target, single, negative,
|
||||
multigot)
|
||||
@@ -15497,7 +15500,18 @@ else
|
||||
@@ -15803,7 +15806,18 @@ else
|
||||
fi
|
||||
|
||||
|
||||
@@ -132,10 +132,10 @@ index da20ab5..63e3da7 100755
|
||||
# Check whether --enable-got was given.
|
||||
if test "${enable_got+set}" = set; then :
|
||||
diff --git a/ld/configure.ac b/ld/configure.ac
|
||||
index 34315e6..5ade9a0 100644
|
||||
index d10c553..9f1b57b 100644
|
||||
--- a/ld/configure.ac
|
||||
+++ b/ld/configure.ac
|
||||
@@ -95,6 +95,16 @@ AC_SUBST(use_sysroot)
|
||||
@@ -94,6 +94,16 @@ AC_SUBST(use_sysroot)
|
||||
AC_SUBST(TARGET_SYSTEM_ROOT)
|
||||
AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
|
||||
|
||||
@@ -153,10 +153,10 @@ index 34315e6..5ade9a0 100644
|
||||
dnl "install_as_default" is set to false if gold is the default linker.
|
||||
dnl "installed_linker" is the installed BFD linker name.
|
||||
diff --git a/ld/ld.h b/ld/ld.h
|
||||
index 162e156..7d6d7ef 100644
|
||||
index ba914b9..9df17da 100644
|
||||
--- a/ld/ld.h
|
||||
+++ b/ld/ld.h
|
||||
@@ -177,6 +177,14 @@ typedef struct
|
||||
@@ -180,6 +180,14 @@ typedef struct
|
||||
in the linker script. */
|
||||
bfd_boolean force_group_allocation;
|
||||
|
||||
@@ -171,11 +171,11 @@ index 162e156..7d6d7ef 100644
|
||||
/* Big or little endian as set on command line. */
|
||||
enum endian_enum endian;
|
||||
|
||||
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
|
||||
index bb5f719..78501e4 100644
|
||||
--- a/ld/ld.texinfo
|
||||
+++ b/ld/ld.texinfo
|
||||
@@ -2480,6 +2480,18 @@ string identifying the original linked file does not change.
|
||||
diff --git a/ld/ld.texi b/ld/ld.texi
|
||||
index 40d79dd..137d46c 100644
|
||||
--- a/ld/ld.texi
|
||||
+++ b/ld/ld.texi
|
||||
@@ -2479,6 +2479,18 @@ string identifying the original linked file does not change.
|
||||
|
||||
Passing @code{none} for @var{style} disables the setting from any
|
||||
@code{--build-id} options earlier on the command line.
|
||||
@@ -195,7 +195,7 @@ index bb5f719..78501e4 100644
|
||||
|
||||
@c man end
|
||||
diff --git a/ld/ldfile.c b/ld/ldfile.c
|
||||
index f7e5473..2cd84d3 100644
|
||||
index b3d166c..3dcbf66 100644
|
||||
--- a/ld/ldfile.c
|
||||
+++ b/ld/ldfile.c
|
||||
@@ -116,6 +116,23 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
|
||||
@@ -223,10 +223,10 @@ index f7e5473..2cd84d3 100644
|
||||
|
||||
/* Try to open a BFD for a lang_input_statement. */
|
||||
diff --git a/ld/ldlex.h b/ld/ldlex.h
|
||||
index 5aa7f6b..cb655e0 100644
|
||||
index 04d6fd5..d7df005 100644
|
||||
--- a/ld/ldlex.h
|
||||
+++ b/ld/ldlex.h
|
||||
@@ -147,6 +147,8 @@ enum option_values
|
||||
@@ -148,6 +148,8 @@ enum option_values
|
||||
OPTION_REQUIRE_DEFINED_SYMBOL,
|
||||
OPTION_ORPHAN_HANDLING,
|
||||
OPTION_FORCE_GROUP_ALLOCATION,
|
||||
@@ -236,10 +236,10 @@ index 5aa7f6b..cb655e0 100644
|
||||
|
||||
/* The initial parser states. */
|
||||
diff --git a/ld/ldmain.c b/ld/ldmain.c
|
||||
index ee5ab11..5f6effd 100644
|
||||
index f31eeb2..25f8497 100644
|
||||
--- a/ld/ldmain.c
|
||||
+++ b/ld/ldmain.c
|
||||
@@ -270,6 +270,8 @@ main (int argc, char **argv)
|
||||
@@ -268,6 +268,8 @@ main (int argc, char **argv)
|
||||
command_line.warn_mismatch = TRUE;
|
||||
command_line.warn_search_mismatch = TRUE;
|
||||
command_line.check_section_addresses = -1;
|
||||
@@ -249,10 +249,10 @@ index ee5ab11..5f6effd 100644
|
||||
/* We initialize DEMANGLING based on the environment variable
|
||||
COLLECT_NO_DEMANGLE. The gcc collect2 program will demangle the
|
||||
diff --git a/ld/lexsup.c b/ld/lexsup.c
|
||||
index 08106bc..d619d50 100644
|
||||
index 86a033a..f07f095 100644
|
||||
--- a/ld/lexsup.c
|
||||
+++ b/ld/lexsup.c
|
||||
@@ -538,6 +538,14 @@ static const struct ld_option ld_options[] =
|
||||
@@ -543,6 +543,14 @@ static const struct ld_option ld_options[] =
|
||||
{ {"orphan-handling", required_argument, NULL, OPTION_ORPHAN_HANDLING},
|
||||
'\0', N_("=MODE"), N_("Control how orphan sections are handled."),
|
||||
TWO_DASHES },
|
||||
@@ -267,7 +267,7 @@ index 08106bc..d619d50 100644
|
||||
};
|
||||
|
||||
#define OPTION_COUNT ARRAY_SIZE (ld_options)
|
||||
@@ -550,6 +558,7 @@ parse_args (unsigned argc, char **argv)
|
||||
@@ -555,6 +563,7 @@ parse_args (unsigned argc, char **argv)
|
||||
int ingroup = 0;
|
||||
char *default_dirlist = NULL;
|
||||
char *shortopts;
|
||||
@@ -275,9 +275,9 @@ index 08106bc..d619d50 100644
|
||||
struct option *longopts;
|
||||
struct option *really_longopts;
|
||||
int last_optind;
|
||||
@@ -1534,6 +1543,14 @@ parse_args (unsigned argc, char **argv)
|
||||
}
|
||||
break;
|
||||
@@ -1543,6 +1552,14 @@ parse_args (unsigned argc, char **argv)
|
||||
}
|
||||
break;
|
||||
|
||||
+ case OPTION_NO_POISON_SYSTEM_DIRECTORIES:
|
||||
+ command_line.poison_system_directories = FALSE;
|
||||
@@ -290,7 +290,7 @@ index 08106bc..d619d50 100644
|
||||
case OPTION_PUSH_STATE:
|
||||
input_flags.pushed = xmemdup (&input_flags,
|
||||
sizeof (input_flags),
|
||||
@@ -1577,6 +1594,10 @@ parse_args (unsigned argc, char **argv)
|
||||
@@ -1586,6 +1603,10 @@ parse_args (unsigned argc, char **argv)
|
||||
command_line.soname = NULL;
|
||||
}
|
||||
|
||||
@@ -302,5 +302,5 @@ index 08106bc..d619d50 100644
|
||||
{
|
||||
lang_leave_group ();
|
||||
--
|
||||
2.9.4
|
||||
2.7.4
|
||||
|
||||
@@ -5,4 +5,4 @@ sha512 e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b19
|
||||
sha512 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30 binutils-2.31.1.tar.xz
|
||||
|
||||
# Locally calculated (fetched from Github)
|
||||
sha512 bea88164ed48733bad63393fe702e12e651efd113aa4f3fe2e253e05c4c1e5da20b5a99333f0b5528df6d32ce806f799211c568e1916845a87999901dde28817 binutils-arc-2018.03.tar.gz
|
||||
sha512 a96dfcea6064fcd1aac1333ac0d631491bed8b0be9bdcf62f1447909c8f30d2cb8d9323ffeb7c9ad6b326ecddb72e3d28281684e73343189d0a4a37a11aef62f binutils-gdb-arc-2018.09-release.tar.gz
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
BINUTILS_VERSION = $(call qstrip,$(BR2_BINUTILS_VERSION))
|
||||
ifeq ($(BINUTILS_VERSION),)
|
||||
ifeq ($(BR2_arc),y)
|
||||
BINUTILS_VERSION = arc-2018.03
|
||||
BINUTILS_VERSION = arc-2018.09-release
|
||||
else
|
||||
BINUTILS_VERSION = 2.29.1
|
||||
endif
|
||||
endif # BINUTILS_VERSION
|
||||
|
||||
ifeq ($(BINUTILS_VERSION),arc-2018.03)
|
||||
ifeq ($(BINUTILS_VERSION),arc-2018.09-release)
|
||||
BINUTILS_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,binutils-gdb,$(BINUTILS_VERSION))
|
||||
BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.gz
|
||||
BINUTILS_SOURCE = binutils-gdb-$(BINUTILS_VERSION).tar.gz
|
||||
BINUTILS_FROM_GIT = y
|
||||
endif
|
||||
BINUTILS_SITE ?= $(BR2_GNU_MIRROR)/binutils
|
||||
|
||||
Reference in New Issue
Block a user