Re: linux-next: Tree for March 8 (BROKEN: arch/x86/kernel/entry_32.S?Debian's binutils/as?)

From: Sedat Dilek
Date: Tue Mar 08 2011 - 07:44:45 EST


On 3/8/11, Sedat Dilek <sedat.dilek@xxxxxxxxxxxxxx> wrote:
> Hi,
>
> my build of linux-next (next-20110308, the same with the one from
> yesterday) is broken.
> (I translated the German output.)
>
> [ build.log ]
> AS arch/x86/kernel/entry_32.o
> /home/sd/src/linux-2.6/linux-2.6.38-rc7/debian/build/source_i386_none/arch/x86/kernel/entry_32.S:
> Assembler messages:
> /home/sd/src/linux-2.6/linux-2.6.38-rc7/debian/build/source_i386_none/arch/x86/kernel/entry_32.S:1421:
> Error: .size expression does not evaluate to a constant
> make[6]: *** [arch/x86/kernel/entry_32.o] Fehler 1 (Error 1)
> make[5]: *** [arch/x86/kernel] Fehler 2 (Error 2)
> make[4]: *** [arch/x86] Fehler 2 (Error 2)
> make[4]: *** Warte auf noch nicht beendete Prozesse... (Waiting for
> unfinished jobs...)
>
> I am not sure if this is a problem of Debian's binutils snapshot from
> binutils-2_21-branch (Debian-version: 2.21.0.20110302-1) from sid/i386
> or this is only a problem for x86, but I just want to let you know.
>
> FYI: The previous binutils (2.21.0.20110216-2) works fine.
>
> I have tried with reverting the last two changes to
> arch/x86/kernel/entry_32.S in linux-next:
>
> "x86: Use {push,pop}_cfi in more places" (see [1])
> "x86, asm: Cleanup unnecssary macros in asm-offsets.c" (see [2])
>
> Reverting both or [1] or [2] breaks with Debians as (2.21.0.20110302-1).
>
> BTW, [3] has a complete GIT history for the above file.
>
> So, I am unsure from where the problem exactly aroses.
> If this a known issue (and a fix around) or rings a bell to you, let
> me and others know.
>
> Thanks in advance.
>
> Regards,
> - Sedat -
>
> [1]
> http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=commit;h=60cf637a13932a4750da6746efd0199e8a4c341b
>
> [2]
> http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=commit;h=7bf04be8f48ceeeffa5b5a79734d6d6e0d59e5f8
>
> [3]
> http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=history;f=arch/x86/kernel/entry_32.S;h=2878821cb8c1da1d7147b26271114fa9546afe03;hb=HEAD
>

I just jumped on binutils-2_21-branch GIT and looked what changed in
gas/ directory.

So there were two patches to consider in the time 2011-03-02 and
2011-02-16 (chronological order, latest listed as first):

[1] commit a57ef8e7f3b214e0cf9ee33bb17c11f9f63bf6aa
"* symbols.c (report_op_error): Remove unnecessary forward declaration."

[2] commit 345bbf7731af2912390e72b86807eb1b2af3e27b
"PR gas/12519"

Reverting [1] still breaks build.
With reverting [1] and [2] I had success.
(Unfortunately, both patches have made changes to gas/ChangeLog, so
for isolating only [2] I had no fun and time).

As a conclusion:
It looks like the "PR gas/12519" patch breaks the linux-next kernel
(or l-n needs some modifications?).
It's up to the experts.

Hope this helps to fix the problem.

- Sedat -

P.S.: I have added both revert-patches.

[1] http://sourceware.org/git/?p=binutils.git;a=commit;h=a57ef8e7f3b214e0cf9ee33bb17c11f9f63bf6aa

[2] http://sourceware.org/git/?p=binutils.git;a=commit;h=345bbf7731af2912390e72b86807eb1b2af3e27b
From a961491daceb17d4d060e1a51025b1eb9e2e32cf Mon Sep 17 00:00:00 2001
From: Sedat Dilek <sedat.dilek@xxxxxxxxx>
Date: Tue, 8 Mar 2011 11:54:39 +0100
Subject: [PATCH 1/2] Revert " * symbols.c (report_op_error): Remove unnecessary forward declaration."

This reverts commit a57ef8e7f3b214e0cf9ee33bb17c11f9f63bf6aa.
---
gas/ChangeLog | 8 -----
gas/symbols.c | 99 ++++++++++++++++++++++++++-------------------------------
2 files changed, 45 insertions(+), 62 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 488d7b4..caa9b1e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,11 +1,3 @@
-2011-02-28 Alan Modra <amodra@xxxxxxxxx>
-
- * symbols.c (report_op_error): Remove unnecessary forward declaration.
- Add "op" parameter. Report operator and operand segments in error
- message, not operand symbols.
- (resolve_symbol_value): Always set segment for equated symbols, not
- just when finalizing. Adjust report_op_error calls.
-
2011-02-25 Alan Modra <amodra@xxxxxxxxx>

PR gas/12519
diff --git a/gas/symbols.c b/gas/symbols.c
index 91d0cdb..9a4e2be 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -1,7 +1,7 @@
/* symbols.c -symbol table-
Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
- 2011 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Free Software Foundation, Inc.

This file is part of GAS, the GNU Assembler.

@@ -72,6 +72,7 @@ static long dollar_label_instance (long);
static long fb_label_instance (long);

static void print_binary (FILE *, const char *, expressionS *);
+static void report_op_error (symbolS *, symbolS *, symbolS *);

/* Return a pointer to a new symbol. Die if we can't make a new
symbol. Fill in the symbol's values. Add symbol to end of symbol
@@ -969,65 +970,55 @@ use_complex_relocs_for (symbolS * symp)
#endif

static void
-report_op_error (symbolS *symp, symbolS *left, operatorT op, symbolS *right)
+report_op_error (symbolS *symp, symbolS *left, symbolS *right)
{
char *file;
unsigned int line;
- segT seg_left = left ? S_GET_SEGMENT (left) : 0;
- segT seg_right = S_GET_SEGMENT (right);
- const char *opname;
-
- switch (op)
- {
- default:
- abort ();
- return;
-
- case O_uminus: opname = "-"; break;
- case O_bit_not: opname = "~"; break;
- case O_logical_not: opname = "!"; break;
- case O_multiply: opname = "*"; break;
- case O_divide: opname = "/"; break;
- case O_modulus: opname = "%"; break;
- case O_left_shift: opname = "<<"; break;
- case O_right_shift: opname = ">>"; break;
- case O_bit_inclusive_or: opname = "|"; break;
- case O_bit_or_not: opname = "|~"; break;
- case O_bit_exclusive_or: opname = "^"; break;
- case O_bit_and: opname = "&"; break;
- case O_add: opname = "+"; break;
- case O_subtract: opname = "-"; break;
- case O_eq: opname = "=="; break;
- case O_ne: opname = "!="; break;
- case O_lt: opname = "<"; break;
- case O_le: opname = "<="; break;
- case O_ge: opname = ">="; break;
- case O_gt: opname = ">"; break;
- case O_logical_and: opname = "&&"; break;
- case O_logical_or: opname = "||"; break;
- }
+ segT seg_left = S_GET_SEGMENT (left);
+ segT seg_right = right ? S_GET_SEGMENT (right) : 0;

if (expr_symbol_where (symp, &file, &line))
{
- if (left)
+ if (seg_left == undefined_section)
as_bad_where (file, line,
- _("invalid operands (%s and %s sections) for `%s'"),
- seg_left->name, seg_right->name, opname);
- else
+ _("undefined symbol `%s' in operation"),
+ S_GET_NAME (left));
+ if (seg_right == undefined_section)
as_bad_where (file, line,
- _("invalid operand (%s section) for `%s'"),
- seg_right->name, opname);
+ _("undefined symbol `%s' in operation"),
+ S_GET_NAME (right));
+ if (seg_left != undefined_section
+ && seg_right != undefined_section)
+ {
+ if (right)
+ as_bad_where (file, line,
+ _("invalid sections for operation on `%s' and `%s'"),
+ S_GET_NAME (left), S_GET_NAME (right));
+ else
+ as_bad_where (file, line,
+ _("invalid section for operation on `%s'"),
+ S_GET_NAME (left));
+ }
+
}
else
{
- const char *sname = S_GET_NAME (symp);
-
- if (left)
- as_bad (_("invalid operands (%s and %s sections) for `%s' when setting `%s'"),
- seg_left->name, seg_right->name, opname, sname);
- else
- as_bad (_("invalid operand (%s section) for `%s' when setting `%s'"),
- seg_right->name, opname, sname);
+ if (seg_left == undefined_section)
+ as_bad (_("undefined symbol `%s' in operation setting `%s'"),
+ S_GET_NAME (left), S_GET_NAME (symp));
+ if (seg_right == undefined_section)
+ as_bad (_("undefined symbol `%s' in operation setting `%s'"),
+ S_GET_NAME (right), S_GET_NAME (symp));
+ if (seg_left != undefined_section
+ && seg_right != undefined_section)
+ {
+ if (right)
+ as_bad (_("invalid sections for operation on `%s' and `%s' setting `%s'"),
+ S_GET_NAME (left), S_GET_NAME (right), S_GET_NAME (symp));
+ else
+ as_bad (_("invalid section for operation on `%s' setting `%s'"),
+ S_GET_NAME (left), S_GET_NAME (symp));
+ }
}
}

@@ -1220,8 +1211,8 @@ resolve_symbol_value (symbolS *symp)
symp->sy_value.X_add_number = final_val;
/* Use X_op_symbol as a flag. */
symp->sy_value.X_op_symbol = add_symbol;
+ final_seg = seg_left;
}
- final_seg = seg_left;
final_val = 0;
resolved = symbol_resolved_p (add_symbol);
symp->sy_resolving = 0;
@@ -1270,7 +1261,7 @@ resolve_symbol_value (symbolS *symp)
~S -> S ^ ~0 only permitted on absolute */
if (op != O_logical_not && seg_left != absolute_section
&& finalize_syms)
- report_op_error (symp, NULL, op, add_symbol);
+ report_op_error (symp, add_symbol, NULL);

if (final_seg == expr_section || final_seg == undefined_section)
final_seg = absolute_section;
@@ -1347,7 +1338,7 @@ resolve_symbol_value (symbolS *symp)
probably need to be changed for an object file format which
supports arbitrary expressions, such as IEEE-695. */
if (!(seg_left == absolute_section
- && seg_right == absolute_section)
+ && seg_right == absolute_section)
&& !(op == O_eq || op == O_ne)
&& !((op == O_subtract
|| op == O_lt || op == O_le || op == O_ge || op == O_gt)
@@ -1358,7 +1349,7 @@ resolve_symbol_value (symbolS *symp)
/* Don't emit messages unless we're finalizing the symbol value,
otherwise we may get the same message multiple times. */
if (finalize_syms)
- report_op_error (symp, add_symbol, op, op_symbol);
+ report_op_error (symp, add_symbol, op_symbol);
/* However do not move the symbol into the absolute section
if it cannot currently be resolved - this would confuse
other parts of the assembler into believing that the
--
1.7.4.1

From c51488569df7489374b5c6b2825f187186af5f8b Mon Sep 17 00:00:00 2001
From: Sedat Dilek <sedat.dilek@xxxxxxxxx>
Date: Tue, 8 Mar 2011 12:38:41 +0100
Subject: [PATCH 2/2] Revert " PR gas/12519"

This reverts commit 345bbf7731af2912390e72b86807eb1b2af3e27b.
---
gas/ChangeLog | 5 -----
gas/config/obj-elf.c | 24 ++++++++++++++++++------
ld/testsuite/ChangeLog | 5 -----
ld/testsuite/ld-mn10300/i135409-3.s | 2 +-
ld/testsuite/ld-sh/sh64/stolib.s | 2 +-
5 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index caa9b1e..78dc2d7 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,8 +1,3 @@
-2011-02-25 Alan Modra <amodra@xxxxxxxxx>
-
- PR gas/12519
- * config/obj-elf.c (elf_frob_symbol): Properly handle size expression.
-
2011-02-01 Alan Modra <amodra@xxxxxxxxx>

Backport from mainline
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 969a509..c6dc8d6 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -1,6 +1,6 @@
/* ELF object file format
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.

This file is part of GAS, the GNU Assembler.
@@ -1889,11 +1889,23 @@ elf_frob_symbol (symbolS *symp, int *puntp)

if (sy_obj->size != NULL)
{
- if (resolve_expression (sy_obj->size)
- && sy_obj->size->X_op == O_constant)
- S_SET_SIZE (symp, sy_obj->size->X_add_number);
- else
- as_bad (_(".size expression does not evaluate to a constant"));
+ switch (sy_obj->size->X_op)
+ {
+ case O_subtract:
+ S_SET_SIZE (symp,
+ (S_GET_VALUE (sy_obj->size->X_add_symbol)
+ + sy_obj->size->X_add_number
+ - S_GET_VALUE (sy_obj->size->X_op_symbol)));
+ break;
+ case O_constant:
+ S_SET_SIZE (symp,
+ (S_GET_VALUE (sy_obj->size->X_add_symbol)
+ + sy_obj->size->X_add_number));
+ break;
+ default:
+ as_bad (_(".size expression too complicated to fix up"));
+ break;
+ }
free (sy_obj->size);
sy_obj->size = NULL;
}
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 1b8f84e..56a7a11 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,8 +1,3 @@
-2011-02-25 Alan Modra <amodra@xxxxxxxxx>
-
- * ld-mn10300/i135409-3.s: Correct .size label reference.
- * ld-sh/sh64/stolib.s: Likewise.
-
2011-02-10 Alan Modra <amodra@xxxxxxxxx>

* ld-gc/start.d: Exclude frv-*-linux*.
diff --git a/ld/testsuite/ld-mn10300/i135409-3.s b/ld/testsuite/ld-mn10300/i135409-3.s
index 8113b78..e83ad96 100644
--- a/ld/testsuite/ld-mn10300/i135409-3.s
+++ b/ld/testsuite/ld-mn10300/i135409-3.s
@@ -10,7 +10,7 @@ A:
BOTTOM:
.balign 0x8
add D0,D1
- .size _func, .-_func
+ .size _func, .-func

.data
L001:
diff --git a/ld/testsuite/ld-sh/sh64/stolib.s b/ld/testsuite/ld-sh/sh64/stolib.s
index a5dee2b..587faa6 100644
--- a/ld/testsuite/ld-sh/sh64/stolib.s
+++ b/ld/testsuite/ld-sh/sh64/stolib.s
@@ -4,4 +4,4 @@
bar:
ptabs r18, tr0
blink tr0, r63
-.Lfe_bar: .size bar,.Lfe_bar-bar
+ .Lfe_bar: .size bar,.Lfe_bar-X
--
1.7.4.1