Skip to content

[RFE]: Missing altmacro support in integrated assembler #19292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
llvmbot opened this issue Feb 21, 2014 · 17 comments
Closed

[RFE]: Missing altmacro support in integrated assembler #19292

llvmbot opened this issue Feb 21, 2014 · 17 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla mc Machine (object) code

Comments

@llvmbot
Copy link
Member

llvmbot commented Feb 21, 2014

Bugzilla Link 18918
Resolution FIXED
Resolved on Sep 09, 2017 15:29
Version trunk
OS Linux
Depends On #9620
Blocks #4440 #21794 #22065 #24719 #32752
Attachments Test case., Extended Test Case, Work in Progress Patch
Reporter LLVM Bugzilla Contributor
CC @atamazov,@compnerd,@emaste,@ismail,@rengolin,@rnk

Extended Description

Hi,

While compiling coreboot, AMD's AGESA vendor assembler code blows up with the following macro expansion:

src/vendorcode/amd/agesa/f14/gcccar.inc:38:1: error: unknown directive
.altmacro
^
:4:5: error: invalid instruction mnemonic 'local'
LOCAL SetupStack

./src/cpu/amd/agesa/cache_as_ram.inc:67:3: note: while in macro instantiation
AMD_ENABLE_STACK
^
<instantiation>:5:5: error: invalid instruction mnemonic 'local'
LOCAL Real16bMode
~~~~^~~~~~~~~~~~~~~~~

This apears to be due to missing Altmacro support in LLVM's Assembler,
cite: https://sourceware.org/binutils/docs/as/Altmacro.html

Cheers,
Edward O'Callaghan.
@llvmbot
Copy link
Member Author

llvmbot commented Feb 21, 2014

assigned to @compnerd

@llvmbot
Copy link
Member Author

llvmbot commented Feb 28, 2014

Documentation derived from the GAS documentation:

7.4 .altmacro

Enable alternate macro mode, enabling:

LOCAL name [ , … ]
One additional directive, LOCAL, is available. It is used to generate a string replacement for each of the name arguments, and replace any instances of name in each macro expansion. The replacement string is unique in the assembly, and different for each separate macro expansion. LOCAL allows you to write macros that define symbols, without fear of conflict between separate macro expansions.
String delimiters
You can write strings delimited in these other ways besides “string”:

’string’
You can delimit strings with single-quote characters.

You can delimit strings with matching angle brackets.

single-character string escape
To include any single character literally in a string (even if the character would otherwise have some special meaning), you can prefix the character with !’ (an exclamation mark). For example, you can write <4.3 !> 5.4!!>’ to get the literal text 4.3 > 5.4!’. Expression results as strings You can write %expr’ to evaluate the expression expr and use the result as a string.

@compnerd
Copy link
Member

compnerd commented Mar 2, 2014

I was able to hack something together which is able to properly process the "extended test case". However, that is more to figure out how to implement it. It seems that the problem with formalising the support requires splitting out the expression parser. We need to be able to switch the token stream from the lexer to a pre-tokenised stream.

@compnerd
Copy link
Member

compnerd commented Mar 6, 2014

.altmacro wip
This is a WIP patch that I wrote while trying to see if I could formalise the change. It really is two changes squashed into one: the first being the separation of the expression parser to support an alternate input token stream, which still has some issues that I need to work out.

The second is the actual beginnings of an altmacro parser support which is sufficient to get the basic test shown here to pass.

Im posting this here at the request of functorfun over IRC.

@llvmbot
Copy link
Member Author

llvmbot commented Nov 29, 2014

Status on this?

@llvmbot
Copy link
Member Author

llvmbot commented Aug 5, 2015

There is a new patch currently on review which is designed to fix this issue.
http://reviews.llvm.org/D11215

@ismail
Copy link
Contributor

ismail commented Mar 11, 2016

There is a new patch currently on review which is designed to fix this issue.
http://reviews.llvm.org/D11215

Any chance of reviving the patch?

@rengolin
Copy link
Member

Hi Ismail,

Have you seen Jim's comment that the docs are vague? I honestly don't understand myself what altmacro does, and that snippet helps nothing.

His suggestion was to start a thread in the mailing list, trying to gather as much information as possible (examples, other docs, threads) that will support the case for implementing the feature in the exact way it's being proposed.

Not that it's wrong, I have no way of asserting that, but we just need to know what exactly it is before reviewing code.

cheers,
--renato

@emaste
Copy link
Member

emaste commented Jun 11, 2017

One FreeBSD source file (skein implementation) cannot be assembled with the integrated assembler, due to the lack of .altmacro (and some other issues).

Source is here: https://svnweb.freebsd.org/base/head/sys/crypto/skein/amd64/skein_block_asm.s?view=markup

@llvmbot
Copy link
Member Author

llvmbot commented Sep 9, 2017

support for all alternate macro mode ('.altmacro') documented features but 'LOCAL' was recently introduced to llvm by Michael Zuckerman (this one introduces the ability to evaluate compound absolute expressions: https://reviews.llvm.org/rL301797, for example).
'LOCAL' is expected to be done in the nearest future.
please re-assess the relevance of this ticket.

@rengolin
Copy link
Member

rengolin commented Sep 9, 2017

This was created for a bug that has been fixed, but the description is too broad.

I'm closing it, and if someone needs something else to do with macros, they should create a new, specific bug.

@stephenhines
Copy link
Collaborator

mentioned in issue #21794

@llvmbot
Copy link
Member Author

llvmbot commented Nov 26, 2021

mentioned in issue #22065

@llvmbot
Copy link
Member Author

llvmbot commented Nov 26, 2021

mentioned in issue #24719

@emaste
Copy link
Member

emaste commented Nov 26, 2021

mentioned in issue #32752

@edwintorok
Copy link
Contributor

mentioned in issue #4440

@nlewycky
Copy link
Contributor

mentioned in issue #9620

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla mc Machine (object) code
Projects
None yet
Development

No branches or pull requests

8 participants