Re: Compiling Coreutils with masm=intel

2023-09-14 Thread Arsen Arsenović

Jay  writes:

> Hello, thank you for your reply.
>
> I am currently writing an assembly rewriting tool, and with information
> gathered throughout my toolchain, Intel syntax, at least for my purpose,
> provides many intuitive ways to rewrite the assembly. Therefore, I was
> hoping to remain consistent with the Intel syntax as I wish to generate an
> assembly file of Coreutils and reassemble it using my tool.
>
> When you mention
>> Coreutils (and gnulib) could work around them, but I'm not sure
>> that's useful.
>
> Would it be possible if you could let me know the workaround? If it is
> impossible to use the Intel syntax, then I will probably need to work on
> porting my tool over to AT&T, but I would like to keep many options open if
> possible.

[entire email cited above as the ML was dropped from CC, with previous
 emails dropped]

Hi,

Please keep the mailing list in CC, as it is useful to archive
discussion (this usually involves using Reply All or such in your mail
client).

> When you mention
>> Coreutils (and gnulib) could work around them, but I'm not sure
>> that's useful.
>
> Would it be possible if you could let me know the workaround? If it is
> impossible to use the Intel syntax, then I will probably need to work on
> porting my tool over to AT&T, but I would like to keep many options open if
> possible.

No problem.  The bug report you found mentions this issue, which is that
global symbols with names that match up with instruction mnemonics in
Intel syntax confuse the assembler.  The workaround would be to rename
those (e.g. 'or' in src/test.c), but that would confuse developers and
break API.  I'm more partial to the patch proposed in that PR (comment
23), which would add quoting to some pieces of ASM output.  I'm not sure
if it fixes this case, though, and I don't have time to test it now.  If
you do test it, please post feedback on the PR.

Note that -masm=intel is not very widely used, so YMMV.

Good luck, thank you for your interest, have a lovely day :-)
-- 
Arsen Arsenović


signature.asc
Description: PGP signature


Re: Compiling Coreutils with masm=intel

2023-09-13 Thread Arsen Arsenović

Jay  writes:

> Hello,
>
> I am trying to compile coreutils with the following commands:
>
> CC=gcc CFLAGS="-O0 -gdwarf-2 -save-temps=obj -Wno-error
> -fno-asynchronous-unwind-tables -fno-exceptions" ../configure --prefix
> /home/Documents/coreutils/intelbuild && make -j8
>
> However, it fails with the following message:
> lib/mktime.s: Assembler messages:
> lib/mktime.s:95: Error: invalid use of operator "shr"
> lib/mktime.s:285: Error: invalid use of operator "shr"
> lib/mktime.s:291: Error: invalid use of operator "shr"
> ...
>
> After searching through, I found out that this is some bug?
> https://gcc.gnu.org/bugzilla//show_bug.cgi?id=53929 but I could not find
> any remedy to it. I am wondering whether this has been fixed or it is not
> possible to compile Coreutils with the masm=intel option.

You, indeed, seem to have run into that bug.  Coreutils (and gnulib)
could work around them, but I'm not sure that's useful.

Why do you need the GCC<->AS interface to use Intel syntax, though?

> Thank you in advance.

Have a lovely day.
-- 
Arsen Arsenović


signature.asc
Description: PGP signature