This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Relative expressions and ASSERT


On Thu, Aug 12, 2010 at 8:07 AM, Alan Modra <amodra@gmail.com> wrote:
> I started down the path to treating all constants as absolute, and
> fairly rapidly found that was unworkable, as we need to distinguish
> between a plain numerical value and an absolute address. ?So I made
> constants have a NULL section. ?This allows some nice simplification
> when setting up result section in fold_binary; ?No special case for
> '+' or '-' is needed, I think.
>
> Most of the patch is fairly obvious, but I had to make a few hacks for
> ORIGIN, to get ld-scripts/memaddr.t to pass. ?ORIGIN was returning an
> absolute value (correctly, it really is an address) but this was being
> turned into a plain constant by exp_nameop. ?exp_nameop can be made to
> behave by simply saying the result is invalid during the initial pass
> through script expressions. ?Then it's possible to return a relative
> value for ORIGIN, like the test suite expects. ?I originally just
> fixed the test suite but I'll leave that to a followup patch.
>
> I don't intend to commit this patch immediately. ?I'm sure it will
> break some scripts, but if breakage is not too common then this chance
> to improve ld sanity may be worthwhile.
>
> ? ? ? ?* ldexp.c (make_non_rel, new_number): New functions.
> ? ? ? ?(make_abs, exp_get_abs_int): Cope with NULL expld.result.section.
> ? ? ? ?(fold_unary <'~', '!', '-'>): make_non_rel instead of make_abs.
> ? ? ? ?(fold_binary): Simplify result section logic. ?Return NULL section
> ? ? ? ?for logical ops.
> ? ? ? ?(fold_name <SIZEOF_HEADERS>): Return new_number, not new_abs.
> ? ? ? ?(fold_name <DEFINED, SIZEOF, ALIGNOF, LENGTH, CONSTANT>): Likewise.
> ? ? ? ?(fold_name <ORIGIN>): Don't return valid result when
> ? ? ? ?lang_first_phase_enum. ?Return new_rel, not new_abs.
> ? ? ? ?(exp_fold_tree_1 <etree_value>): Return new_number, not new_rel.
> ? ? ? ?(exp_fold_tree_1): Ajust for NULL expld.result.section. ?When assigning
> ? ? ? ?a plain number to dot, assume the value is relative to expld.section.
> ? ? ? ?Make numbers not in an output section, absolute.
> ? ? ? ?* ldlang.c (print_assignment): Fix style nit.
> ? ? ? ?(lang_size_sections_1): Cope with NULL expld.result.section.
> ? ? ? ?(lang_do_assignments_1): Likewise.
>

You can try the new linker on Linux kernel.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]